# HG changeset patch # User Sylvain Thénault # Date 1333023641 -7200 # Node ID 622fcca4fe003803233394b5f7973bf8d97744e3 # Parent ac2b17bd73114a126e1e999df26c3fcb7f1c7b4b [form renderer] refactor inline form renderer to ease overriding. Closes #2282662 diff -r ac2b17bd7311 -r 622fcca4fe00 web/views/formrenderers.py --- a/web/views/formrenderers.py Mon Mar 26 13:29:27 2012 +0200 +++ b/web/views/formrenderers.py Thu Mar 29 14:20:41 2012 +0200 @@ -492,9 +492,20 @@ entity's form. """ __regid__ = 'inline' + fieldset_css_class = 'subentity' def render(self, w, form, values): form.add_media() + self.open_form(w, form, values) + self.render_title(w, form, values) + # XXX that stinks + # cleanup values + for key in ('title', 'removejs', 'removemsg'): + values.pop(key, None) + self.render_fields(w, form, values) + self.close_form(w, form, values) + + def open_form(self, w, form, values): try: w(u'
' % values) except KeyError: @@ -503,7 +514,11 @@ w(u'
%s
' % ( values['divid'], self._cw._('click on the box to cancel the deletion'))) w(u'
') - eschema = form.edited_entity.e_schema + + def close_form(self, w, form, values): + w(u'
') + + def render_title(self, w, form, values): if values['removejs']: values['removemsg'] = self._cw._('remove-inlined-entity-form') w(u'
%(title)s ' @@ -514,18 +529,12 @@ w(u'
%(title)s ' '#%(counter)s
' % values) - # XXX that stinks - # cleanup values - for key in ('title', 'removejs', 'removemsg'): - values.pop(key, None) - self.render_fields(w, form, values) - w(u'
') def render_fields(self, w, form, values): w(u'
' % values) fields = self._render_hidden_fields(w, form) w(u'
') - w(u'
') + w(u'
' % self.fieldset_css_class) if fields: self._render_fields(fields, w, form) self.render_child_forms(w, form, values)