--- 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'<a href="%s">%s</a>'
def call(self, view=None, first_separator=True):
entity = self.rset.get_entity(0, 0)
path = entity.breadcrumbs(view)
if path:
- self.w(u'<span id="breadcrumbs" class="pathbar">')
+ self.open_breadcrumbs()
if first_separator:
self.w(self.separator)
self.render_breadcrumbs(entity, path)
- self.w(u'</span>')
+ self.close_breadcrumbs()
+
+ def open_breadcrumbs(self):
+ self.w(u'<span id="breadcrumbs" class="pathbar">')
+
+ def close_breadcrumbs(self):
+ self.w(u'</span>')
def render_breadcrumbs(self, contextentity, path):
root = path.pop(0)
if isinstance(root, Entity):
- self.w(u'<a href="%s">%s</a>' % (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'<a href="%s">%s</a>' % (
+ self.w(self.link_template % (
xml_escape(url), xml_escape(uilib.cut(title, textsize))))
else:
textsize = self.req.property_value('navigation.short-line-size')