comparison MoinMoin/themes/__init__.py @ 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 49bc6f85f918
children 7b7e07bb6f8a
comparison
equal deleted inserted replaced
2281:5bc7db3fbb87 2282:5c424120a253
216 if not title: 216 if not title:
217 title = shorten_fqname(CompositeName(namespace, field, item_name)) 217 title = shorten_fqname(CompositeName(namespace, field, item_name))
218 return href, title, wiki_name 218 return href, title, wiki_name
219 219
220 @timed() 220 @timed()
221 def navibar(self, item_name): 221 def navibar(self, fqname):
222 """ 222 """
223 Assemble the navibar 223 Assemble the navibar
224 224
225 :rtype: list 225 :rtype: list
226 :returns: list of tuples (css_class, url, link_text, title) 226 :returns: list of tuples (css_class, url, link_text, title)
227 """ 227 """
228 if not isinstance(fqname, CompositeName):
229 fqname = split_fqname(fqname)
230 item_name = fqname.value
228 current = item_name 231 current = item_name
229 # Process config navi_bar 232 # Process config navi_bar
230 items = [] 233 items = []
231 for cls, endpoint, args, link_text, title in self.cfg.navi_bar: 234 for cls, endpoint, args, link_text, title in self.cfg.navi_bar:
232 if endpoint == "frontend.show_root": 235 if endpoint == "frontend.show_root":
233 endpoint = "frontend.show_item" 236 endpoint = "frontend.show_item"
234 args['item_name'] = app.cfg.root_mapping.get(NAMESPACE_DEFAULT, app.cfg.default_root) 237 root_fqname = fqname.get_root_fqname()
238 args['item_name'] = root_fqname.fullname
239 elif endpoint in ["frontend.global_history", "frontend.global_tags"]:
240 args['namespace'] = fqname.namespace
241 elif endpoint == "frontend.index":
242 args['item_name'] = fqname.namespace
235 items.append((cls, url_for(endpoint, **args), link_text, title)) 243 items.append((cls, url_for(endpoint, **args), link_text, title))
236 244
237 # Add user links to wiki links. 245 # Add user links to wiki links.
238 for text in self.user.quicklinks: 246 for text in self.user.quicklinks:
239 url, link_text, title = self.split_navilink(text) 247 url, link_text, title = self.split_navilink(text)