72 _editlogo = 'pen_icon.png' |
72 _editlogo = 'pen_icon.png' |
73 |
73 |
74 # renderer |
74 # renderer |
75 _form_renderer_id = 'base' |
75 _form_renderer_id = 'base' |
76 |
76 |
77 def cell_call(self, row, col, rtype=None, role='subject', |
77 def entity_call(self, entity, rtype=None, role='subject', |
78 reload=False, # controls reloading the whole page after change |
78 reload=False, # controls reloading the whole page after change |
79 # boolean, eid (to redirect), or |
79 # boolean, eid (to redirect), or |
80 # function taking the subject entity & returning a boolean or an eid |
80 # function taking the subject entity & returning a boolean or an eid |
81 rvid=None, # vid to be applied to other side of rtype (non final relations only) |
81 rvid=None, # vid to be applied to other side of rtype (non final relations only) |
82 default_value=None, |
82 default_value=None, |
83 formid='base', |
83 formid='base', |
84 action=None |
84 action=None |
85 ): |
85 ): |
86 """display field to edit entity's `rtype` relation on click""" |
86 """display field to edit entity's `rtype` relation on click""" |
87 assert rtype |
87 assert rtype |
88 self._cw.add_css('cubicweb.form.css') |
88 self._cw.add_css('cubicweb.form.css') |
89 self._cw.add_js(('cubicweb.reledit.js', 'cubicweb.edition.js', 'cubicweb.ajax.js')) |
89 self._cw.add_js(('cubicweb.reledit.js', 'cubicweb.edition.js', 'cubicweb.ajax.js')) |
90 self.entity = self.cw_rset.get_entity(row, col) |
90 self.entity = entity |
91 rschema = self._cw.vreg.schema[rtype] |
91 rschema = self._cw.vreg.schema[rtype] |
92 self._rules = rctrl.etype_get(self.entity.e_schema.type, rschema.type, role, '*') |
92 self._rules = rctrl.etype_get(self.entity.e_schema.type, rschema.type, role, '*') |
93 if rvid is not None or default_value is not None: |
93 if rvid is not None or default_value is not None: |
94 warn('[3.9] specifying rvid/default_value on select is deprecated, ' |
94 warn('[3.9] specifying rvid/default_value on select is deprecated, ' |
95 'reledit_ctrl rtag to control this' % self, DeprecationWarning) |
95 'reledit_ctrl rtag to control this' % self, DeprecationWarning) |