X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=mediagoblin%2Ftemplates%2Fmediagoblin%2Futils%2Fwtforms.html;h=e2921258e76c25e78eeefc0827b068991a9da36a;hb=283043f14d8fdeb8cccad00b7d7cb7a8cc5a17bd;hp=4038de9855bd9e148e8b06d6c6395ab532a890c1;hpb=f305707e7c013bfee196e9166d6af9836132a345;p=mediagoblin.git
diff --git a/mediagoblin/templates/mediagoblin/utils/wtforms.html b/mediagoblin/templates/mediagoblin/utils/wtforms.html
index 4038de98..e2921258 100644
--- a/mediagoblin/templates/mediagoblin/utils/wtforms.html
+++ b/mediagoblin/templates/mediagoblin/utils/wtforms.html
@@ -1,6 +1,6 @@
{#
# GNU MediaGoblin -- federated, autonomous media hosting
-# Copyright (C) 2011 Free Software Foundation, Inc
+# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@@ -16,47 +16,122 @@
# along with this program. If not, see .
#}
+{# Render the label for a field #}
+{% macro render_label(field) %}
+ {%- if field.label.text -%}
+
+ {%- endif -%}
+{%- endmacro %}
+
+{# Render the label in a
for a field #}
+{% macro render_label_p(field) %}
+ {%- if field.label.text %}
+
+ {{- render_label(field) -}}
+
+ {%- endif %}
+{%- endmacro %}
+
{# Generically render a field #}
-{% macro render_field_div(field) %}
-
-
{{ _(field.label.text) }}
-
{{ field }}
- {%- if field.errors -%}
- {% for error in field.errors %}
-
+ {% endif %}
{%- endmacro %}
{# Auto-render a form as a series of divs #}
-{% macro render_divs(form) -%}
+{% macro render_divs(form, autofocus_first=False) -%}
{% for field in form %}
- {{ render_field_div(field) }}
+ {% if autofocus_first and loop.first %}
+ {{ render_field_div(field, True) }}
+ {% else %}
+ {{ render_field_div(field) }}
+ {% endif %}
{% endfor %}
{%- endmacro %}
{# Auto-render a form as a table #}
{% macro render_table(form) -%}
{% for field in form %}
-