1. Thomas Waldmann
  2. moin-2.0

Commits

Ashutosh Singla  committed 5c42412

Fixed #21, now links in navbar link to current namespace.

  • Participants
  • Parent commits 5bc7db3
  • Branches default

Comments (0)

Files changed (2)

File MoinMoin/templates/layout.html

View file
         </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 %}

File MoinMoin/themes/__init__.py

View file
         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.