From f7998c3326d7c2ed06a978f721cf6533fbde1c15 Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Wed, 26 Jun 2013 08:29:03 -0700 Subject: [PATCH] fix for boolean fields --- mediagoblin/edit/forms.py | 1 - mediagoblin/static/css/base.css | 4 ++ .../templates/mediagoblin/utils/wtforms.html | 47 ++++++++++++------- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/mediagoblin/edit/forms.py b/mediagoblin/edit/forms.py index e0147a0c..85c243a0 100644 --- a/mediagoblin/edit/forms.py +++ b/mediagoblin/edit/forms.py @@ -66,7 +66,6 @@ class EditAccountForm(wtforms.Form): [wtforms.validators.Optional(), normalize_user_or_email_field(allow_user=False)]) wants_comment_notification = wtforms.BooleanField( - label='', description=_("Email me when others comment on my media")) license_preference = wtforms.SelectField( _('License preference'), diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 8b57584d..995bfc7e 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -334,6 +334,10 @@ text-align: center; width: 20px; } +#boolean { + margin-bottom: 4px; + } + textarea#description, textarea#bio { resize: vertical; height: 100px; diff --git a/mediagoblin/templates/mediagoblin/utils/wtforms.html b/mediagoblin/templates/mediagoblin/utils/wtforms.html index a4c33f1a..2b2cc30a 100644 --- a/mediagoblin/templates/mediagoblin/utils/wtforms.html +++ b/mediagoblin/templates/mediagoblin/utils/wtforms.html @@ -34,26 +34,26 @@ {# Generically render a field #} {% macro render_field_div(field, autofocus_first=False) %} - {{- render_label_p(field) }} -
- {% if autofocus_first %} - {{ field(autofocus=True) }} - {% else %} - {{ field }} - {% endif %} - {%- if field.errors -%} - {% for error in field.errors %} -

{{ error }}

- {% endfor %} - {%- endif %} - {%- if field.description %} - {% if field.type == 'BooleanField' %} - + {% if field.type == 'BooleanField' %} + {{ render_bool(field) }} + {% else %} + {{- render_label_p(field) }} +
+ {% if autofocus_first %} + {{ field(autofocus=True) }} {% else %} -

{{ field.description|safe }}

+ {{ field }} {% endif %} - {%- endif %} -
+ {%- if field.errors -%} + {% for error in field.errors %} +

{{ error }}

+ {% endfor %} + {%- endif %} + {%- if field.description %} +

{{ field.description|safe }}

+ {%- endif %} +
+ {% endif %} {%- endmacro %} {# Auto-render a form as a series of divs #} @@ -86,3 +86,14 @@ {% endfor %} {%- endmacro %} + +{# Render a boolean field #} +{% macro render_bool(field) %} +
+ +
+{% endmacro %} + -- 2.25.1