diff --git a/calsocial/templates/_macros.html b/calsocial/templates/_macros.html new file mode 100644 index 0000000..633314d --- /dev/null +++ b/calsocial/templates/_macros.html @@ -0,0 +1,21 @@ +{% macro field(field, inline=false) %} + {% if field.errors %} + {% for error in field.errors %} +{{ error }} + {% endfor %} +
+ {% endif %} + {% if field.widget.input_type != 'checkbox' %} +{{ field.label }} + {% endif %} +{{ field }} + {% if field.widget.input_type == 'checkbox' %} +{{ field.label }} + {% endif %} +{% if not inline %} +
+{% endif %} + {% if field.description %} +{{ field.description }} + {% endif %} +{% endmacro %} diff --git a/calsocial/templates/event-details.html b/calsocial/templates/event-details.html index 26dff7b..d6bd2ba 100644 --- a/calsocial/templates/event-details.html +++ b/calsocial/templates/event-details.html @@ -1,4 +1,5 @@ {% extends 'base.html' %} +{% from '_macros.html' import field %} {% block content %}

@@ -28,9 +29,7 @@
{{ form.hidden_tag() }} - {{ form.invitee.errors }} - {{ form.invitee.label }} - {{ form.invitee}} + {{ field(form.invitee, inline=true) }}
diff --git a/calsocial/templates/event-edit.html b/calsocial/templates/event-edit.html index 831526f..483f2c0 100644 --- a/calsocial/templates/event-edit.html +++ b/calsocial/templates/event-edit.html @@ -1,41 +1,24 @@ {% extends 'base.html' %} +{% from '_macros.html' import field %} {% block content %} +

Create event

{{ form.hidden_tag() }} - {{ form.errors }} + {% if form.errors %} + {% for error in form.errors %} + {{ error }} + {% endfor %}
+ {% endif %} - {{ form.title.errors }} - {{ form.title.label }} - {{ form.title }} -
- - {{ form.time_zone.errors }} - {{ form.time_zone.label }} - {{ form.time_zone }} -
- - {{ form.start_time.errors }} - {{ form.start_time.label }} - {{ form.start_time }} -
- - {{ form.end_time.errors }} - {{ form.end_time.label }} - {{ form.end_time }} -
- - {{ form.all_day.errors }} - {{ form.all_day.label }} - {{ form.all_day }} -
- - {{ form.description.errors }} - {{ form.description.label }} - {{ form.description }} -
+ {{ field(form.title) }} + {{ field(form.time_zone) }} + {{ field(form.start_time) }} + {{ field(form.end_time) }} + {{ field(form.all_day) }} + {{ field(form.description) }} Cancel diff --git a/calsocial/templates/first-steps.html b/calsocial/templates/first-steps.html index faf6249..f534cf7 100644 --- a/calsocial/templates/first-steps.html +++ b/calsocial/templates/first-steps.html @@ -1,4 +1,5 @@ {% extends 'base.html' %} +{% from '_macros.html' import field %} {% block content %}

{% trans %}First steps{% endtrans %}

@@ -13,17 +14,10 @@ {{ form.hidden_tag() }}

- {{ form.display_name.errors }} - {{ form.display_name.label }} - {{ form.display_name }}
- {{ form.display_name.description }} + {{ field(form.display_name) }}

-

- {{ form.time_zone.errors }} - {{ form.time_zone.label }} - {{ form.time_zone }}
- {{ form.time_zone.description }} + {{ field(form.time_zone) }}

diff --git a/calsocial/templates/profile-edit.html b/calsocial/templates/profile-edit.html index 0953be4..6d54c04 100644 --- a/calsocial/templates/profile-edit.html +++ b/calsocial/templates/profile-edit.html @@ -1,4 +1,5 @@ {% extends 'settings-base.html' %} +{% from '_macros.html' import field %} {% block content %} {{ super() }} @@ -7,15 +8,8 @@ {{ form.hidden_tag() }} {{ form.errors }} - {{ form.display_name.errors }} - {{ form.display_name.label }} - {{ form.display_name }} -
- - {{ form.locked.errors }} - {{ form.locked.label }} - {{ form.locked}} -
+ {{ field(form.display_name) }} + {{ field(form.locked) }}
diff --git a/calsocial/templates/registration.html b/calsocial/templates/registration.html index 95f3977..2cc7c0a 100644 --- a/calsocial/templates/registration.html +++ b/calsocial/templates/registration.html @@ -1,29 +1,15 @@ {% extends 'base.html' %} +{% from '_macros.html' import field %} {% block content %}
{{ form.errors }} {{ form.hidden_tag() }} - {{ form.username.errors }} - {{ form.username.label }} - {{ form.username }} -
- - {{ form.email.errors }} - {{ form.email.label }} - {{ form.email }} -
- - {{ form.password.errors }} - {{ form.password.label }} - {{ form.password }} -
- - {{ form.password_retype.errors }} - {{ form.password_retype.label }} - {{ form.password_retype }} -
+ {{ field(form.username) }} + {{ field(form.email) }} + {{ field(form.password) }} + {{ field(form.password_retype) }}
diff --git a/calsocial/templates/user-settings.html b/calsocial/templates/user-settings.html index 5141f07..a7d8d11 100644 --- a/calsocial/templates/user-settings.html +++ b/calsocial/templates/user-settings.html @@ -1,4 +1,5 @@ {% extends 'settings-base.html' %} +{% from '_macros.html' import field %} {% block content %} {{ super() }} @@ -9,10 +10,7 @@ {{ form.errors }}
- {{ form.timezone.errors }} - {{ form.timezone.label }} - {{ form.timezone}} -
+ {{ field(form.timezone) }} Cancel