equal
deleted
inserted
replaced
14 |
14 |
15 from cubicweb.common import tags |
15 from cubicweb.common import tags |
16 from cubicweb.appobject import AppObject |
16 from cubicweb.appobject import AppObject |
17 from cubicweb.selectors import entity_implements, yes |
17 from cubicweb.selectors import entity_implements, yes |
18 from cubicweb.web import eid_param, formwidgets as fwdgs |
18 from cubicweb.web import eid_param, formwidgets as fwdgs |
19 from cubicweb.web.formfields import HiddenInitialValueField |
19 from cubicweb.web.widgets import checkbox |
20 |
20 |
21 def checkbox(name, value, attrs='', checked=None): |
21 def checkbox(name, value, attrs='', checked=None): |
22 if checked is None: |
22 if checked is None: |
23 checked = value |
23 checked = value |
24 checked = checked and 'checked="checked"' or '' |
24 checked = checked and 'checked="checked"' or '' |
166 if form.cwtarget: |
166 if form.cwtarget: |
167 tag += ' cubicweb:target="%s"' % xml_escape(form.cwtarget) |
167 tag += ' cubicweb:target="%s"' % xml_escape(form.cwtarget) |
168 return tag + '>' |
168 return tag + '>' |
169 |
169 |
170 def display_field(self, form, field): |
170 def display_field(self, form, field): |
171 if isinstance(field, HiddenInitialValueField): |
|
172 field = field.visible_field |
|
173 return (self.display_fields is None |
171 return (self.display_fields is None |
174 or field.name in form.internal_fields |
172 or field.name in form.internal_fields |
175 or (field.name, field.role) in self.display_fields |
173 or (field.name, field.role) in self.display_fields |
176 or (field.name, field.role) in form.internal_fields) |
174 or (field.name, field.role) in form.internal_fields) |
177 |
175 |
255 """ |
253 """ |
256 __select__ = entity_implements('Any') |
254 __select__ = entity_implements('Any') |
257 |
255 |
258 def display_field(self, form, field): |
256 def display_field(self, form, field): |
259 if not super(EntityBaseFormRenderer, self).display_field(form, field): |
257 if not super(EntityBaseFormRenderer, self).display_field(form, field): |
260 if isinstance(field, HiddenInitialValueField): |
|
261 field = field.visible_field |
|
262 ismeta = form.edited_entity.e_schema.is_metadata(field.name) |
258 ismeta = form.edited_entity.e_schema.is_metadata(field.name) |
263 return ismeta is not None and ( |
259 return ismeta is not None and ( |
264 ismeta[0] in self.display_fields or |
260 ismeta[0] in self.display_fields or |
265 (ismeta[0], 'subject') in self.display_fields) |
261 (ismeta[0], 'subject') in self.display_fields) |
266 return True |
262 return True |