changeset 2282:5c424120a253

Fixed #21, now links in navbar link to current namespace.
author Ashutosh Singla <ashu1461@gmail.com>
date Sun, 22 Sep 2013 00:41:24 +0530
parents 5bc7db3fbb87
children c10ce803517a
files MoinMoin/templates/layout.html MoinMoin/themes/__init__.py
diffstat 2 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/templates/layout.html	Wed Sep 18 19:45:39 2013 +0530
+++ b/MoinMoin/templates/layout.html	Sun Sep 22 00:41:24 2013 +0530
@@ -131,7 +131,7 @@
         </div>
     {% endif %}
 
-    {% set navibar_items = theme_supp.navibar(item_name) %}
+    {% set navibar_items = theme_supp.navibar(fqname) %}
     {% if navibar_items %}
         <ul id="moin-navibar" class="panel">
         {% for cls, url, text, title in navibar_items %}
--- a/MoinMoin/themes/__init__.py	Wed Sep 18 19:45:39 2013 +0530
+++ b/MoinMoin/themes/__init__.py	Sun Sep 22 00:41:24 2013 +0530
@@ -218,20 +218,28 @@
         return href, title, wiki_name
 
     @timed()
-    def navibar(self, item_name):
+    def navibar(self, fqname):
         """
         Assemble the navibar
 
         :rtype: list
         :returns: list of tuples (css_class, url, link_text, title)
         """
+        if not isinstance(fqname, CompositeName):
+            fqname = split_fqname(fqname)
+        item_name = fqname.value
         current = item_name
         # Process config navi_bar
         items = []
         for cls, endpoint, args, link_text, title in self.cfg.navi_bar:
             if endpoint == "frontend.show_root":
                 endpoint = "frontend.show_item"
-                args['item_name'] = app.cfg.root_mapping.get(NAMESPACE_DEFAULT, app.cfg.default_root)
+                root_fqname = fqname.get_root_fqname()
+                args['item_name'] = root_fqname.fullname
+            elif endpoint in ["frontend.global_history", "frontend.global_tags"]:
+                args['namespace'] = fqname.namespace
+            elif endpoint == "frontend.index":
+                args['item_name'] = fqname.namespace
             items.append((cls, url_for(endpoint, **args), link_text, title))
 
         # Add user links to wiki links.