changeset 2679:e130fc605c63

Solves issue #394 Displayed Namespaces in User tab instead of dropdown in the modernized theme and used div instead of span in the same to avoid HTML validation error as a span should not contain a ul
author Ajitesh Gupta <ajgupta93@gmail.com>
date Fri, 25 Jul 2014 19:39:17 +0530
parents c040fb080073
children d324ef0ab68e
files MoinMoin/apps/admin/templates/user/index_user.html MoinMoin/templates/layout.html MoinMoin/themes/__init__.py
diffstat 3 files changed, 29 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/admin/templates/user/index_user.html	Sat Jul 19 17:22:05 2014 +0200
+++ b/MoinMoin/apps/admin/templates/user/index_user.html	Fri Jul 25 19:39:17 2014 +0530
@@ -1,16 +1,24 @@
 {% extends theme("layout.html") %}
 {% block content %}
-<h1>{{ _("Documentation") }}</h1>
-<ul>
-    <li><a href="{{ url_for('serve.files', name='docs', filename='index.html') }}">{{ _("Documentation (local)") }}</a></li>
-</ul>
-<h1>{{ _("User Menu") }}</h1>
-<ul>
-    <li><a href="{{ url_for('frontend.mychanges') }}">{{ _("My Changes") }}</a></li>
-    <li><a href="{{ url_for('frontend.wanted_items') }}">{{ _("Wanted Items") }}</a></li>
-    <li><a href="{{ url_for('frontend.orphaned_items') }}">{{ _("Orphaned Items") }}</a></li>
-    <li><a href="{{ url_for('admin.itemsize') }}">{{ _("Item Sizes (last revision)") }}</a></li>
-    <li><a href="{{ url_for('admin.interwikihelp') }}">{{ _("InterWiki Names") }}</a></li>
-    <li><a href="{{ url_for('admin.highlighterhelp') }}">{{ _("Highlighters") }}</a></li>
-</ul>
+    <h1>{{ _("User Menu") }}</h1>
+    <h2>{{ _("Documentation") }}</h2>
+    <ul>
+        <li><a href="{{ url_for('serve.files', name='docs', filename='index.html') }}">{{ _("Documentation (local)") }}</a></li>
+    </ul>
+    <h2>{{ _("Reports") }}</h2>
+    <ul>
+        <li><a href="{{ url_for('frontend.mychanges') }}">{{ _("My Changes") }}</a></li>
+        <li><a href="{{ url_for('frontend.wanted_items') }}">{{ _("Wanted Items") }}</a></li>
+        <li><a href="{{ url_for('frontend.orphaned_items') }}">{{ _("Orphaned Items") }}</a></li>
+        <li><a href="{{ url_for('admin.itemsize') }}">{{ _("Item Sizes (last revision)") }}</a></li>
+        <li><a href="{{ url_for('admin.interwikihelp') }}">{{ _("InterWiki Names") }}</a></li>
+        <li><a href="{{ url_for('admin.highlighterhelp') }}">{{ _("Highlighters") }}</a></li>
+    </ul>
+    <h2>{{ _("Namespaces") }}</h2>
+    <ul class="moin-bcs-subitems">
+        <li><a href="{{ url_for('frontend.global_views') }}">{{ _("all") }}</a></li>
+        {% for namespace, root in theme_supp.get_namespaces()|sort -%}
+            <li><a href="{{ url_for('frontend.show_item', item_name=root) }}">{{ namespace }}</a></li>
+        {%- endfor %}
+    </ul>
 {% endblock %}
--- a/MoinMoin/templates/layout.html	Sat Jul 19 17:22:05 2014 +0200
+++ b/MoinMoin/templates/layout.html	Fri Jul 25 19:39:17 2014 +0530
@@ -68,22 +68,14 @@
             <span class="sep">: </span>
         </span>
         {%- endif %}
-        <span id="moin-pagelocation">
-            <span class="moin-pagepath">
+        <div id="moin-pagelocation">
+            <div class="moin-pagepath">
             {% block pagepath %}
             {% for segment_name, segment_path, exists in theme_supp.location_breadcrumbs(fqname) -%}
                 {% if loop.first %}
                     <ul class="moin-bcs-item">
                         <li>
                             <a href="{{ url_for('frontend.show_item', item_name=segment_path) }}" {% if not exists %}class="moin-nonexistent"{% endif %}>{{ segment_name|shorten_fqname }}</a>
-                            <ul class="moin-bcs-subitems">
-                                {% for namespace, root in theme_supp.get_namespaces(segment_name) -%}
-                                    <li><a href="{{ url_for('frontend.show_item', item_name=root) }}">{{ namespace }}</a></li>
-                                {%- endfor %}
-                                {% if fqname and fqname.namespace != "all" %}
-                                    <li><a href="{{ url_for('frontend.global_views') }}">{{ _("all") }}</a></li>
-                                {%- endif %}
-                           </ul>
                         </li>
                     </ul>
                     <span class="sep">/</span>
@@ -109,8 +101,8 @@
                 {%- endif %}
             {%- endfor %}
             {% endblock %}
-            </span>
-        </span>
+            </div>
+        </div>
     </div>
 
     {% set trail_items = theme_supp.path_breadcrumbs() %}
--- a/MoinMoin/themes/__init__.py	Sat Jul 19 17:22:05 2014 +0200
+++ b/MoinMoin/themes/__init__.py	Fri Jul 25 19:39:17 2014 +0530
@@ -462,16 +462,17 @@
         fqnames.remove(fqname)
         return fqnames or []
 
-    def get_namespaces(self, ns):
+    def get_namespaces(self, ns=None):
         """
         Return the list of tuples (composite name, namespace) referring to namespaces other
         than the current namespace.
         """
-        ns = u'' if ns.value == '~' else ns.value
+        if ns is not None and ns.value == '~':
+            ns = u''
         namespace_root_mapping = []
         for namespace, _ in app.cfg.namespace_mapping:
             namespace = namespace.rstrip('/')
-            if namespace != ns:
+            if ns is None or namespace != ns:
                 fq_namespace = CompositeName(namespace, NAME_EXACT, u'')
                 namespace_root_mapping.append((namespace or '~', fq_namespace.get_root_fqname()))
         return namespace_root_mapping