12 from cubicweb import Unauthorized, role as get_role |
12 from cubicweb import Unauthorized, role as get_role |
13 from cubicweb.common.registerers import ( |
13 from cubicweb.common.registerers import ( |
14 accepts_registerer, extresources_registerer, |
14 accepts_registerer, extresources_registerer, |
15 etype_rtype_priority_registerer) |
15 etype_rtype_priority_registerer) |
16 from cubicweb.common.selectors import ( |
16 from cubicweb.common.selectors import ( |
17 etype_rtype_selector, one_line_rset, accept_selector, accept_rtype_selector, |
17 etype_rtype_selector, one_line_rset, accept, accept_rtype_selector, |
18 primaryview_selector, contextprop_selector, has_related_entities, |
18 primary_view, match_context_prop, has_related_entities, |
19 _rqlcondition_selector) |
19 _rqlcondition_selector) |
20 from cubicweb.common.view import Template |
20 from cubicweb.common.view import Template |
21 from cubicweb.common.appobject import ReloadableMixIn |
21 from cubicweb.common.appobject import ReloadableMixIn |
22 |
22 |
23 from cubicweb.web.htmlwidgets import (BoxLink, BoxWidget, SideBoxWidget, |
23 from cubicweb.web.htmlwidgets import (BoxLink, BoxWidget, SideBoxWidget, |
40 to fetch desired actions, and then to do something like :: |
40 to fetch desired actions, and then to do something like :: |
41 |
41 |
42 box.render(self.w) |
42 box.render(self.w) |
43 """ |
43 """ |
44 __registry__ = 'boxes' |
44 __registry__ = 'boxes' |
45 __selectors__ = Template.__selectors__ + (contextprop_selector,) |
45 __selectors__ = Template.__selectors__ + (match_context_prop,) |
46 |
46 |
47 categories_in_order = () |
47 categories_in_order = () |
48 property_defs = { |
48 property_defs = { |
49 _('visible'): dict(type='Boolean', default=True, |
49 _('visible'): dict(type='Boolean', default=True, |
50 help=_('display the box or not')), |
50 help=_('display the box or not')), |
148 |
148 |
149 |
149 |
150 class EntityBoxTemplate(BoxTemplate): |
150 class EntityBoxTemplate(BoxTemplate): |
151 """base class for boxes related to a single entity""" |
151 """base class for boxes related to a single entity""" |
152 __registerer__ = accepts_registerer |
152 __registerer__ = accepts_registerer |
153 __selectors__ = (one_line_rset, primaryview_selector, |
153 __selectors__ = (one_line_rset, primary_view, |
154 contextprop_selector, etype_rtype_selector, |
154 match_context_prop, etype_rtype_selector, |
155 accept_rtype_selector, accept_selector, |
155 accept_rtype_selector, accept, |
156 _rqlcondition_selector) |
156 _rqlcondition_selector) |
157 accepts = ('Any',) |
157 accepts = ('Any',) |
158 context = 'incontext' |
158 context = 'incontext' |
159 condition = None |
159 condition = None |
160 |
160 |