equal
deleted
inserted
replaced
19 from cubicweb.common import tags, uilib |
19 from cubicweb.common import tags, uilib |
20 |
20 |
21 |
21 |
22 class BreadCrumbEntityVComponent(Component): |
22 class BreadCrumbEntityVComponent(Component): |
23 id = 'breadcrumbs' |
23 id = 'breadcrumbs' |
24 __select__ = one_line_rset() & implements(IBreadCrumbs) |
24 __select__ = one_line_rset() & implements(IBreadCrumbs, accept_none=False) |
25 |
25 |
26 property_defs = { |
26 property_defs = { |
27 _('visible'): dict(type='Boolean', default=True, |
27 _('visible'): dict(type='Boolean', default=True, |
28 help=_('display the component or not')), |
28 help=_('display the component or not')), |
29 } |
29 } |
68 textsize = self.req.property_value('navigation.short-line-size') |
68 textsize = self.req.property_value('navigation.short-line-size') |
69 self.w(uilib.cut(unicode(part), textsize)) |
69 self.w(uilib.cut(unicode(part), textsize)) |
70 |
70 |
71 |
71 |
72 class BreadCrumbETypeVComponent(BreadCrumbEntityVComponent): |
72 class BreadCrumbETypeVComponent(BreadCrumbEntityVComponent): |
73 __select__ = two_lines_rset() & one_etype_rset() & implements(IBreadCrumbs) |
73 __select__ = two_lines_rset() & one_etype_rset() & \ |
|
74 implements(IBreadCrumbs, accept_none=False) |
74 |
75 |
75 def render_breadcrumbs(self, contextentity, path): |
76 def render_breadcrumbs(self, contextentity, path): |
76 # XXX hack: only display etype name or first non entity path part |
77 # XXX hack: only display etype name or first non entity path part |
77 root = path.pop(0) |
78 root = path.pop(0) |
78 if isinstance(root, Entity): |
79 if isinstance(root, Entity): |