refactor a bit breadcrumbs to ease overriding of the root's display
authorAlexandre Richardson <alexandre.richardson@logilab.fr>
Thu, 17 Sep 2015 12:47:39 +0200
changeset 11186 6bc480ec5665
parent 11185 40e74d6d7e99
child 11187 5213dfe9cddb
refactor a bit breadcrumbs to ease overriding of the root's display
cubicweb/web/views/ibreadcrumbs.py
--- a/cubicweb/web/views/ibreadcrumbs.py	Wed Jan 14 13:35:22 2015 +0100
+++ b/cubicweb/web/views/ibreadcrumbs.py	Thu Sep 17 12:47:39 2015 +0200
@@ -121,13 +121,16 @@
     def close_breadcrumbs(self, w):
         w(u'</span>')
 
-    def render_breadcrumbs(self, w, contextentity, path):
+    def render_root(self, w, contextentity, path):
         root = path.pop(0)
         if isinstance(root, Entity):
             w(self.link_template % (self._cw.build_url(root.__regid__),
                                          root.dc_type('plural')))
             w(self.separator)
         self.wpath_part(w, root, contextentity, not path)
+ 
+    def render_breadcrumbs(self, w, contextentity, path):
+        self.render_root(w, contextentity, path)
         for i, parent in enumerate(path):
             w(self.separator)
             w(u"\n")