changeset 81:4bc420e70b51

Cleanup forms rendering.
author Daniele Nicolodi <daniele@grinta.net>
date Sun, 21 Aug 2011 16:01:25 +0200
parents 06cf88d1e445
children 8dfcaabaee15
files src/ltpdarepo/templates/forms.html
diffstat 1 files changed, 7 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/ltpdarepo/templates/forms.html	Sun Aug 21 16:01:01 2011 +0200
+++ b/src/ltpdarepo/templates/forms.html	Sun Aug 21 16:01:25 2011 +0200
@@ -19,22 +19,16 @@
         {% if field.type in ('HiddenField', 'SubmitField') %}
           {{ field }}
         {% else %}
-          {% if field.errors %}
-          <div class="field error">
-          {% else %}
-          <div class="field">
-          {% endif %}
-            {{ field.label }} {% if field.flags.required %}<span class="required">*</span>{% endif %}
-            {% if field.errors %}
-              <div class="error"><ul>
-                {% for error in field.errors %}
-                  <li>{{ error }}</li>
-                {% endfor %}
-              </ul></div>
-            {% endif %}
+          {% set cssclass = 'field' %}
+          {% if field.flags.required %}{% set cssclass = cssclass + ' required' %}{% endif %}
+          <div class="{{ cssclass }}">
+            {{ field.label }}
             {% if field.description %}
               <div class="help">{{ field.description }}</div>
             {% endif %}
+            {% if field.errors %}
+              <span class="error">{{ ' '.join(field.errors) }}</span>
+            {% endif %}
             <div class="widget">{{ field }}</div>
           </div>
         {% endif %}