# HG changeset patch # User Adrien Di Mascio # Date 1258388328 -3600 # Node ID 4908c7156eabde4406b9992a4a1ada8fe5c36861 # Parent 535db4d4ff578fbabe9c2309bf09b1c295fa9b6f [breadcrumbs] make it easier to redefine html structure of breadcrumbs component diff -r 535db4d4ff57 -r 4908c7156eab web/views/ibreadcrumbs.py --- a/web/views/ibreadcrumbs.py Mon Nov 16 15:44:42 2009 +0100 +++ b/web/views/ibreadcrumbs.py Mon Nov 16 17:18:48 2009 +0100 @@ -30,22 +30,29 @@ title = _('contentnavigation_breadcrumbs') help = _('contentnavigation_breadcrumbs_description') separator = u' > ' + link_template = u'%s' def call(self, view=None, first_separator=True): entity = self.rset.get_entity(0, 0) path = entity.breadcrumbs(view) if path: - self.w(u'') + self.open_breadcrumbs() if first_separator: self.w(self.separator) self.render_breadcrumbs(entity, path) - self.w(u'') + self.close_breadcrumbs() + + def open_breadcrumbs(self): + self.w(u'') + + def close_breadcrumbs(self): + self.w(u'') def render_breadcrumbs(self, contextentity, path): root = path.pop(0) if isinstance(root, Entity): - self.w(u'%s' % (self.req.build_url(root.id), - root.dc_type('plural'))) + self.w(self.link_template % (self.req.build_url(root.id), + root.dc_type('plural'))) self.w(self.separator) self.wpath_part(root, contextentity, not path) for i, parent in enumerate(path): @@ -62,7 +69,7 @@ elif isinstance(part, tuple): url, title = part textsize = self.req.property_value('navigation.short-line-size') - self.w(u'%s' % ( + self.w(self.link_template % ( xml_escape(url), xml_escape(uilib.cut(title, textsize)))) else: textsize = self.req.property_value('navigation.short-line-size')