fix for boolean fields

This commit is contained in:
Rodney Ewing 2013-06-26 08:29:03 -07:00
parent 0ec7ce4ec6
commit f7998c3326
3 changed files with 33 additions and 19 deletions

View File

@ -66,7 +66,6 @@ class EditAccountForm(wtforms.Form):
[wtforms.validators.Optional(), [wtforms.validators.Optional(),
normalize_user_or_email_field(allow_user=False)]) normalize_user_or_email_field(allow_user=False)])
wants_comment_notification = wtforms.BooleanField( wants_comment_notification = wtforms.BooleanField(
label='',
description=_("Email me when others comment on my media")) description=_("Email me when others comment on my media"))
license_preference = wtforms.SelectField( license_preference = wtforms.SelectField(
_('License preference'), _('License preference'),

View File

@ -334,6 +334,10 @@ text-align: center;
width: 20px; width: 20px;
} }
#boolean {
margin-bottom: 4px;
}
textarea#description, textarea#bio { textarea#description, textarea#bio {
resize: vertical; resize: vertical;
height: 100px; height: 100px;

View File

@ -34,6 +34,9 @@
{# Generically render a field #} {# Generically render a field #}
{% macro render_field_div(field, autofocus_first=False) %} {% macro render_field_div(field, autofocus_first=False) %}
{% if field.type == 'BooleanField' %}
{{ render_bool(field) }}
{% else %}
{{- render_label_p(field) }} {{- render_label_p(field) }}
<div class="form_field_input"> <div class="form_field_input">
{% if autofocus_first %} {% if autofocus_first %}
@ -47,13 +50,10 @@
{% endfor %} {% endfor %}
{%- endif %} {%- endif %}
{%- if field.description %} {%- if field.description %}
{% if field.type == 'BooleanField' %}
<label for="{{ field.label.field_id }}">{{ field.description|safe }}</label>
{% else %}
<p class="form_field_description">{{ field.description|safe }}</p> <p class="form_field_description">{{ field.description|safe }}</p>
{% endif %}
{%- endif %} {%- endif %}
</div> </div>
{% endif %}
{%- endmacro %} {%- endmacro %}
{# Auto-render a form as a series of divs #} {# Auto-render a form as a series of divs #}
@ -86,3 +86,14 @@
</tr> </tr>
{% endfor %} {% endfor %}
{%- endmacro %} {%- endmacro %}
{# Render a boolean field #}
{% macro render_bool(field) %}
<div id="boolean">
<label for="{{ field.label.field_id }}">
{{ field }}</input>
{{ field.description|safe }}
</label>
</div>
{% endmacro %}