Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Improve the appearance of the forms in case of errors

Roland Geider578af0fe1e6b
diff --git a/manager/templates/form_snippet.html b/manager/templates/form_snippet.html
index 5b436eb5a..915327701 100644
--- a/manager/templates/form_snippet.html
+++ b/manager/templates/form_snippet.html
@@ -1,17 +1,20 @@
{% load i18n %}
<tr id="form-{{field.name}}">
<td style="text-align:right;">
+ {% if field.errors %}<div class="ym-fbox-text ym-error"><span class="ym-message">{% endif %}
{% trans field.label %}
+ {% if field.errors %}</span></div>{% endif %}
</td>
<td>
- <div class="{{css_class|default:"ym-fbox-text"}}">
+ <div class="{{css_class|default:'ym-fbox-text'}} {% if field.errors %}ym-error{% endif %}">
{{ field }}
</div>
- {% if field.help_text %}<p class="dimmed">{{ field.help_text }}</p>{% endif %}
<div class="ym-fbox-text ym-error">
{% for error in field.errors %}
<p class="ym-message">{% trans error %}</p>
{% endfor %}
</div>
+
+ {% if field.help_text %}<p class="dimmed">{{ field.help_text }}</p>{% endif %}
</td>
</tr>
\ No newline at end of file