diff -r 5926626fb27b -r 56764b1b4887 web/formrenderers.py --- a/web/formrenderers.py Fri Apr 17 18:44:01 2009 +0200 +++ b/web/formrenderers.py Fri Apr 17 18:44:17 2009 +0200 @@ -19,6 +19,15 @@ class FormRenderer(object): """basic renderer displaying fields in a two columns table label | value + + +--------------+--------------+ + | field1 label | field1 input | + +--------------+--------------+ + | field1 label | field2 input | + +--------------+--------------+ + +---------+ + | buttons | + +---------+ """ display_fields = None # None -> all fields display_label = True @@ -186,6 +195,47 @@ w(u'') +class HTableFormRenderer(FormRenderer): + """display fields horizontally in a table + + +--------------+--------------+---------+ + | field1 label | field2 label | | + +--------------+--------------+---------+ + | field1 input | field2 input | buttons + +--------------+--------------+---------+ + """ + display_help = False + def _render_fields(self, fields, w, form, values): + w(u'') + w(u'') + for field in fields: + if self.display_label: + w(u'' % self.render_label(form, field)) + if self.display_help: + w(self.render_help(form, field)) + # empty slot for buttons + w(u'') + w(u'') + w(u'') + for field in fields: + error = form.form_field_error(field) + if error: + w(u'') + w(u'') + w(u'') + w(u'
%s 
') + w(error) + else: + w(u'') + w(field.render(form, self)) + w(u'') + for button in form.form_buttons: + w(button.render(form)) + w(u'
') + + def render_buttons(self, w, form): + pass + class EntityCompositeFormRenderer(FormRenderer): """specific renderer for multiple entities edition form (muledit)"""