[forms] Fix HTableFormRenderer _render_fields method behavior when display_label is False.
authorVladimir Popescu <vladimir.popescu@logilab.fr>
Tue, 06 May 2014 17:45:37 +0200
changeset 11207 d7c7423f4ea6
parent 11206 6454ee8f2137
child 11208 fe57dc4adfea
[forms] Fix HTableFormRenderer _render_fields method behavior when display_label is False. Indeed, now the extra <tr><th>...</th></tr> are not inserted anymore unless display_label is True. Closes #3811325.
cubicweb/web/views/formrenderers.py
--- a/cubicweb/web/views/formrenderers.py	Tue Mar 17 15:21:29 2015 +0100
+++ b/cubicweb/web/views/formrenderers.py	Tue May 06 17:45:37 2014 +0200
@@ -312,15 +312,15 @@
     display_help = False
     def _render_fields(self, fields, w, form):
         w(u'<table border="0" class="htableForm">')
-        w(u'<tr>')
-        for field in fields:
-            if self.display_label:
+        if self.display_label:
+            w(u'<tr>')
+            for field in fields:
                 w(u'<th class="labelCol">%s</th>' % self.render_label(form, field))
-            if self.display_help:
-                w(self.render_help(form, field))
-        # empty slot for buttons
-        w(u'<th class="labelCol">&#160;</th>')
-        w(u'</tr>')
+                if self.display_help:
+                    w(self.render_help(form, field))
+            # empty slot for buttons
+            w(u'<th class="labelCol">&#160;</th>')
+            w(u'</tr>')
         w(u'<tr>')
         for field in fields:
             error = form.field_error(field)