Commits

Ajitesh Gupta committed b9133a7

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".

Comments (0)

Files changed (3)

MoinMoin/apps/frontend/views.py

     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,
                            initials=initials,
                            startswith=startswith,
                            form=form,
-                           title_name=_(u'Global Index'),
+                           title_name=title_name,
     )
 
 

MoinMoin/config/default.py

             # 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, ),

MoinMoin/themes/basic/templates/layout.html

                             <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>