From 8566cdda713566ef632b78388fa9016a704f6e55 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 28 May 2011 09:54:09 -0500 Subject: [PATCH] Added a new form rendering system, render_divs, and using it for registration --- .../templates/mediagoblin/auth/register.html | 15 ++++++------ .../templates/mediagoblin/utils/wtforms.html | 24 +++++++++++++++++++ 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/mediagoblin/templates/mediagoblin/auth/register.html b/mediagoblin/templates/mediagoblin/auth/register.html index 610c7cc4..31c3d23e 100644 --- a/mediagoblin/templates/mediagoblin/auth/register.html +++ b/mediagoblin/templates/mediagoblin/auth/register.html @@ -20,14 +20,15 @@ {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %} {% block mediagoblin_content %} +

Create an account!

+
- - {{ wtforms_util.render_table(register_form) }} - - - - -
+
+ {{ wtforms_util.render_divs(register_form) }} +
+ +
+
{% endblock %} diff --git a/mediagoblin/templates/mediagoblin/utils/wtforms.html b/mediagoblin/templates/mediagoblin/utils/wtforms.html index 15556936..4a37ab33 100644 --- a/mediagoblin/templates/mediagoblin/utils/wtforms.html +++ b/mediagoblin/templates/mediagoblin/utils/wtforms.html @@ -15,6 +15,30 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . #} + +{# Auto-render a form as a series of divs #} +{% macro render_divs(form) -%} + {% for field in form %} +
+
{{ field.label }}
+ {% if field.description -%} +
{{ field.description }}
+ {%- endif %} +
{{ field }}
+ {%- if field.errors -%} +
+
    + {% for error in field.errors %} +
  • {{ error }}
  • + {% endfor %} +
+
+ {%- endif %} +
+ {% endfor %} +{%- endmacro %} + +{# Auto-render a form as a table #} {% macro render_table(form) -%} {% for field in form %} -- 2.25.1