2 # GNU MediaGoblin -- federated, autonomous media hosting
3 # Copyright (C)
2011 Free Software Foundation, Inc
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as published by
7 # the Free Software Foundation, either version
3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Affero General Public License for more details.
15 # You should have received a copy of the GNU Affero General Public License
16 # along with this program. If not, see
<http://www.gnu.org/licenses
/>.
19 {# Generically render a field #}
20 {% macro render_field_div(field) %}
21 <div class=
"form_field_box">
22 <div class=
"form_field_label">{{ field.label }}
</div>
23 {% if field.description -%}
24 <div class=
"form_field_description">{{ field.description }}
</div>
26 <div class=
"form_field_input">{{ field }}
</div>
27 {%- if field.errors -%}
28 {% for error in field.errors %}
29 <div class=
"form_field_error">
37 {# Generically render a textarea
38 # ... mostly the same thing except it includes rows and cols #}
39 {% macro render_textarea_div(field, rows=
8, cols=
20) %}
40 <div class=
"form_field_box">
41 <div class=
"form_field_label">{{ field.label }}
</div>
42 {% if field.description -%}
43 <div class=
"form_field_description">{{ field.description }}
</div>
45 <div class=
"form_field_input">{{ field(rows=rows, cols=cols) }}
</div>
46 {%- if field.errors -%}
47 {% for error in field.errors %}
48 <div class=
"form_field_error">
56 {# Auto-render a form as a series of divs #}
57 {% macro render_divs(form) -%}
58 {% for field in form %}
59 {{ render_field_div(field) }}
63 {# Auto-render a form as a table #}
64 {% macro render_table(form) -%}
65 {% for field in form %}
67 <th>{{field.label}}
</th>
73 {% for error in field.errors %}