equal
deleted
inserted
replaced
19 _ = unicode |
19 _ = unicode |
20 |
20 |
21 def bc_title(entity): |
21 def bc_title(entity): |
22 textsize = entity.req.property_value('navigation.short-line-size') |
22 textsize = entity.req.property_value('navigation.short-line-size') |
23 return html_escape(cut(entity.dc_title(), textsize)) |
23 return html_escape(cut(entity.dc_title(), textsize)) |
24 |
24 |
25 |
25 |
26 class BreadCrumbEntityVComponent(EntityVComponent): |
26 class BreadCrumbEntityVComponent(EntityVComponent): |
27 id = 'breadcrumbs' |
27 id = 'breadcrumbs' |
28 # register msg not generated since no entity implements IPrevNext in cubicweb itself |
28 # register msg not generated since no entity implements IPrevNext in cubicweb itself |
29 title = _('contentnavigation_breadcrumbs') |
29 title = _('contentnavigation_breadcrumbs') |
50 for i, parent in enumerate(path): |
50 for i, parent in enumerate(path): |
51 self.w(self.separator) |
51 self.w(self.separator) |
52 self.w(u"\n") |
52 self.w(u"\n") |
53 self.wpath_part(parent, entity, i == len(path) - 1) |
53 self.wpath_part(parent, entity, i == len(path) - 1) |
54 self.w(u'</span>') |
54 self.w(u'</span>') |
55 |
55 |
56 def wpath_part(self, part, contextentity, last=False): |
56 def wpath_part(self, part, contextentity, last=False): |
57 if isinstance(part, Entity): |
57 if isinstance(part, Entity): |
58 if last and part.eid == contextentity.eid: |
58 if last and part.eid == contextentity.eid: |
59 self.w(bc_title(part)) |
59 self.w(bc_title(part)) |
60 else: |
60 else: |
65 self.w(u'<a href="%s">%s</a>' % ( |
65 self.w(u'<a href="%s">%s</a>' % ( |
66 html_escape(url), html_escape(cut(title, textsize)))) |
66 html_escape(url), html_escape(cut(title, textsize)))) |
67 else: |
67 else: |
68 textsize = self.req.property_value('navigation.short-line-size') |
68 textsize = self.req.property_value('navigation.short-line-size') |
69 self.w(cut(unicode(part), textsize)) |
69 self.w(cut(unicode(part), textsize)) |
70 |
70 |
71 |
71 |
72 class BreadCrumbComponent(BreadCrumbEntityVComponent): |
72 class BreadCrumbComponent(BreadCrumbEntityVComponent): |
73 __registry__ = 'components' |
73 __registry__ = 'components' |
74 __select__ = (one_line_rset() & implements(IBreadCrumbs)) |
74 __select__ = (one_line_rset() & implements(IBreadCrumbs)) |
75 visible = True |
75 visible = True |