changeset 2559:b9133a780db8

Fixed location line to show separate location for Global Index and Subitem Index as per issue #410 Earlier the location line used to show the title as "Global Index" for both the global index and the subitems index. This patch fixes that issue by using separate title for the subitems page. If an item's index is being viewed it uses subitem index else it uses global index. Also layout.html has been changed to fix repition of location like "Global Index / Global Index".
author Ajitesh Gupta <ajgupta93@gmail.com>
date Tue, 25 Feb 2014 03:56:09 +0530
parents f66a7a76c7b5
children 19a3aee57a4f
files MoinMoin/apps/frontend/views.py MoinMoin/config/default.py MoinMoin/themes/basic/templates/layout.html
diffstat 3 files changed, 22 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Sun Feb 16 23:49:52 2014 +0530
+++ b/MoinMoin/apps/frontend/views.py	Tue Feb 25 03:56:09 2014 +0530
@@ -873,6 +873,10 @@
     if fqname.value == NAMESPACE_ALL:
         fqname = CompositeName(NAMESPACE_ALL, NAME_EXACT, u'')
     item_names = item_name.split(u'/')
+    if not item_name:
+        title_name = _(u'Global Index')
+    else:
+        title_name = _(u'Subitem Index')
     return render_template(item.index_template,
                            item_names=item_names,
                            item_name=item_name,
@@ -882,7 +886,7 @@
                            initials=initials,
                            startswith=startswith,
                            form=form,
-                           title_name=_(u'Global Index'),
+                           title_name=title_name,
     )
 
 
--- a/MoinMoin/config/default.py	Sun Feb 16 23:49:52 2014 +0530
+++ b/MoinMoin/config/default.py	Tue Feb 25 03:56:09 2014 +0530
@@ -401,7 +401,7 @@
             # so we no longer check, if item_exists for the modify item_view.
             ('frontend.modify_item', L_('Modify'), L_('Edit or Upload'), False, ),
             ('special.supplementation', None, None, False, ),
-            ('frontend.index', L_('Index'), L_('List sub-items'), False, ),
+            ('frontend.index', L_('Subitems'), L_('Subitems Index'), False, ),
             ('special.comments', L_('Comments'), L_('Hide comments'), True, ),
             ('special.transclusions', L_('Transclusions'), L_('Show transclusions'), True, ),
             ('frontend.highlight_item', L_('Highlight'), L_('Show with Syntax-Highlighting'), True, ),
--- a/MoinMoin/themes/basic/templates/layout.html	Sun Feb 16 23:49:52 2014 +0530
+++ b/MoinMoin/themes/basic/templates/layout.html	Tue Feb 25 03:56:09 2014 +0530
@@ -162,27 +162,26 @@
                             <li>
                                 <h4 class="moin-location-breadcrumb">
                                 {% for segment_name, segment_path, exists in theme_supp.location_breadcrumbs(item_name) -%}
-                                {% set url = url_for('frontend.show_item', item_name=segment_path) %}
-                                    {% if not loop.first %}
-                                    <small>/</small>
-                                    {% endif %}
-                                    {% if url != current_url_showview %}
-                                        <small>
-                                    {% endif %}
-                                    {% if title_name %}
-                                        {{ title_name }}
-                                    {% else %}
-                                        <a href="{{ url }}" {% if not exists %}class="moin-nonexistent"{% endif %}>
-                                            {{ segment_name|shorten_item_name }}
+                                    {% if loop.first %}
+                                        <small>~ /</small>
+                                    {% elif not loop.last %}
+                                        <a href="{{ url_for('frontend.show_item', item_name=segment_path) }}" {% if not exists %}class="moin-nonexistent"{% endif %}>
+                                            {{ segment_name|shorten_fqname }}
                                         </a>
-                                    {% endif %}
-                                    {% if url != current_url_showview %}
-                                       </small>
-                                    {% endif %}
+                                        <small>/</small>
+                                    {%- endif %}
+                                    {% if loop.last %}
+                                        {% if title_name %}
+                                            {{ title_name }}
+                                        {% else %}
+                                            <a href="{{ url_for('frontend.show_item', item_name=segment_path) }}" {% if not exists %}class="moin-nonexistent"{% endif %}>
+                                                {{ segment_name|shorten_fqname }}
+                                            </a>              
+                                        {%- endif %}
+                                    {%- endif %}
                                 {% endfor %}
                                 </h4>
                             </li>
-
                         </ul><!-- complete list of breadcrumbs -->
                     </div>
                 </div>