[breadcrumbs] Small breadcrumb components refactoring
authorFlorent Cayre <florent.cayre@logilab.fr>
Thu, 09 Jan 2014 10:53:45 +0100
changeset 9384 430859af32c6
parent 9383 7b3fa5a7a5a3
child 9385 65ad67b0df22
[breadcrumbs] Small breadcrumb components refactoring * use `open_breadcrumbs` and `close_breadcrumbs` methods where applicable in the BreadCrumbEntityVComponent hierarchy * include the first separator related code in `open_breadcrumbs` to avoid code duplication Closes #3223911.
doc/3.18.rst
web/views/ibreadcrumbs.py
--- a/doc/3.18.rst	Mon Jan 06 12:01:35 2014 +0100
+++ b/doc/3.18.rst	Thu Jan 09 10:53:45 2014 +0100
@@ -41,6 +41,9 @@
   get a `name` attribute that maps the CubicWeb contraint entities to
   corresponding backend index.
 
+* BreadCrumbEntityVComponent's open_breadcrumbs method now includes
+  the first breadcrumbs separator
+
 
 Deprecation
 ---------------------
--- a/web/views/ibreadcrumbs.py	Mon Jan 06 12:01:35 2014 +0100
+++ b/web/views/ibreadcrumbs.py	Thu Jan 09 10:53:45 2014 +0100
@@ -115,13 +115,13 @@
         path = adapter.breadcrumbs(view)
         if path:
             self.open_breadcrumbs(w)
-            if self.first_separator:
-                w(self.separator)
             self.render_breadcrumbs(w, entity, path)
             self.close_breadcrumbs(w)
 
     def open_breadcrumbs(self, w):
         w(u'<span id="breadcrumbs" class="pathbar">')
+        if self.first_separator:
+            w(self.separator)
 
     def close_breadcrumbs(self, w):
         w(u'</span>')
@@ -172,11 +172,9 @@
     # XXX support kwargs for compat with other components which gets the view as
     # argument
     def render(self, w, **kwargs):
-        w(u'<span id="breadcrumbs" class="pathbar">')
-        if self.first_separator:
-            w(self.separator)
+        self.open_breadcrumbs(w)
         w(self._cw._('search'))
-        w(u'</span>')
+        self.close_breadcrumbs(w)
 
 
 class BreadCrumbLinkToVComponent(BreadCrumbEntityVComponent):