4 :copyright: 2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
4 :copyright: 2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
6 """ |
6 """ |
7 __docformat__ = "restructuredtext en" |
7 __docformat__ = "restructuredtext en" |
8 |
8 |
9 from cubicweb.common.selectors import (chainfirst, req_form_params_selector, |
9 from cubicweb.common.selectors import (chainfirst, match_form_params, |
10 kwargs_selector) |
10 match_kwargs) |
11 from cubicweb.web.box import EditRelationBoxTemplate |
11 from cubicweb.web.box import EditRelationBoxTemplate |
12 |
12 |
13 class AddRelationView(EditRelationBoxTemplate): |
13 class AddRelationView(EditRelationBoxTemplate): |
14 """base class for view which let add entities linked |
14 """base class for view which let add entities linked |
15 by a given relation |
15 by a given relation |
16 |
16 |
17 subclasses should define at least id, rtype and target |
17 subclasses should define at least id, rtype and target |
18 class attributes. |
18 class attributes. |
19 """ |
19 """ |
20 __registry__ = 'views' |
20 __registry__ = 'views' |
21 __selectors__ = (chainfirst(req_form_params_selector, kwargs_selector),) |
21 __selectors__ = (chainfirst(match_form_params, match_kwargs),) |
22 property_defs = {} # don't want to inherit this from Box |
22 property_defs = {} # don't want to inherit this from Box |
23 id = 'xaddrelation' |
23 id = 'xaddrelation' |
24 expected_kwargs = form_params = ('rtype', 'target') |
24 expected_kwargs = form_params = ('rtype', 'target') |
25 |
25 |
26 build_js = EditRelationBoxTemplate.build_reload_js_call |
26 build_js = EditRelationBoxTemplate.build_reload_js_call |