diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index 249b92113..2a4759fb8 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -9,6 +9,7 @@ from django.utils import timezone from django.utils.translation import gettext_lazy as _ from bookwyrm import models +from bookwyrm.models.fields import ClearableFileInputWithWarning from bookwyrm.models.user import FeedFilterChoices @@ -148,6 +149,17 @@ class EditUserForm(CustomForm): "preferred_language", ] help_texts = {f: None for f in fields} + widgets = { + "avatar": ClearableFileInputWithWarning( + attrs={"aria-describedby": "desc_avatar"} + ), + "name": forms.TextInput(attrs={"aria-describedby": "desc_name"}), + "summary": forms.Textarea(attrs={"aria-describedby": "desc_summary"}), + "email": forms.EmailInput(attrs={"aria-describedby": "desc_email"}), + "discoverable": forms.CheckboxInput( + attrs={"aria-describedby": "desc_discoverable"} + ), + } class LimitedEditUserForm(CustomForm): @@ -161,6 +173,16 @@ class LimitedEditUserForm(CustomForm): "discoverable", ] help_texts = {f: None for f in fields} + widgets = { + "avatar": ClearableFileInputWithWarning( + attrs={"aria-describedby": "desc_avatar"} + ), + "name": forms.TextInput(attrs={"aria-describedby": "desc_name"}), + "summary": forms.Textarea(attrs={"aria-describedby": "desc_summary"}), + "discoverable": forms.CheckboxInput( + attrs={"aria-describedby": "desc_discoverable"} + ), + } class DeleteUserForm(CustomForm): @@ -209,6 +231,51 @@ class EditionForm(CustomForm): "connector", "search_vector", ] + widgets = { + "title": forms.TextInput(attrs={"aria-describedby": "desc_title"}), + "subtitle": forms.TextInput(attrs={"aria-describedby": "desc_subtitle"}), + "description": forms.Textarea( + attrs={"aria-describedby": "desc_description"} + ), + "series": forms.TextInput(attrs={"aria-describedby": "desc_series"}), + "series_number": forms.TextInput( + attrs={"aria-describedby": "desc_series_number"} + ), + "languages": forms.TextInput( + attrs={"aria-describedby": "desc_languages_help desc_languages"} + ), + "publishers": forms.TextInput( + attrs={"aria-describedby": "desc_publishers_help desc_publishers"} + ), + "first_published_date": forms.SelectDateWidget( + attrs={"aria-describedby": "desc_first_published_date"} + ), + "published_date": forms.SelectDateWidget( + attrs={"aria-describedby": "desc_published_date"} + ), + "cover": ClearableFileInputWithWarning( + attrs={"aria-describedby": "desc_cover"} + ), + "physical_format": forms.Select( + attrs={"aria-describedby": "desc_physical_format"} + ), + "physical_format_detail": forms.TextInput( + attrs={"aria-describedby": "desc_physical_format_detail"} + ), + "pages": forms.NumberInput(attrs={"aria-describedby": "desc_pages"}), + "isbn_13": forms.TextInput(attrs={"aria-describedby": "desc_isbn_13"}), + "isbn_10": forms.TextInput(attrs={"aria-describedby": "desc_isbn_10"}), + "openlibrary_key": forms.TextInput( + attrs={"aria-describedby": "desc_openlibrary_key"} + ), + "inventaire_id": forms.TextInput( + attrs={"aria-describedby": "desc_inventaire_id"} + ), + "oclc_number": forms.TextInput( + attrs={"aria-describedby": "desc_oclc_number"} + ), + "ASIN": forms.TextInput(attrs={"aria-describedby": "desc_ASIN"}), + } class AuthorForm(CustomForm): @@ -227,6 +294,28 @@ class AuthorForm(CustomForm): "librarything_key", "goodreads_key", ] + widgets = { + "name": forms.TextInput(attrs={"aria-describedby": "desc_name"}), + "aliases": forms.TextInput(attrs={"aria-describedby": "desc_aliases"}), + "bio": forms.Textarea(attrs={"aria-describedby": "desc_bio"}), + "wikipedia_link": forms.TextInput( + attrs={"aria-describedby": "desc_wikipedia_link"} + ), + "born": forms.SelectDateWidget(attrs={"aria-describedby": "desc_born"}), + "died": forms.SelectDateWidget(attrs={"aria-describedby": "desc_died"}), + "oepnlibrary_key": forms.TextInput( + attrs={"aria-describedby": "desc_oepnlibrary_key"} + ), + "inventaire_id": forms.TextInput( + attrs={"aria-describedby": "desc_inventaire_id"} + ), + "librarything_key": forms.TextInput( + attrs={"aria-describedby": "desc_librarything_key"} + ), + "goodreads_key": forms.TextInput( + attrs={"aria-describedby": "desc_goodreads_key"} + ), + } class ImportForm(forms.Form): @@ -301,12 +390,37 @@ class SiteForm(CustomForm): class Meta: model = models.SiteSettings exclude = [] + widgets = { + "instance_short_description": forms.TextInput( + attrs={"aria-describedby": "desc_instance_short_description"} + ), + "require_confirm_email": forms.CheckboxInput( + attrs={"aria-describedby": "desc_require_confirm_email"} + ), + "invite_request_text": forms.Textarea( + attrs={"aria-describedby": "desc_invite_request_text"} + ), + } class AnnouncementForm(CustomForm): class Meta: model = models.Announcement exclude = ["remote_id"] + widgets = { + "preview": forms.TextInput(attrs={"aria-describedby": "desc_preview"}), + "content": forms.Textarea(attrs={"aria-describedby": "desc_content"}), + "event_date": forms.SelectDateWidget( + attrs={"aria-describedby": "desc_event_date"} + ), + "start_date": forms.SelectDateWidget( + attrs={"aria-describedby": "desc_start_date"} + ), + "end_date": forms.SelectDateWidget( + attrs={"aria-describedby": "desc_end_date"} + ), + "active": forms.CheckboxInput(attrs={"aria-describedby": "desc_active"}), + } class ListForm(CustomForm): @@ -331,6 +445,9 @@ class EmailBlocklistForm(CustomForm): class Meta: model = models.EmailBlocklist fields = ["domain"] + widgets = { + "avatar": forms.TextInput(attrs={"aria-describedby": "desc_domain"}), + } class IPBlocklistForm(CustomForm): diff --git a/bookwyrm/templates/author/edit_author.html b/bookwyrm/templates/author/edit_author.html index 54d7f4f1c..de1a7875e 100644 --- a/bookwyrm/templates/author/edit_author.html +++ b/bookwyrm/templates/author/edit_author.html @@ -34,47 +34,41 @@
{{ form.name }} - {% for error in form.name.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.name.errors id="desc_name" %}
{{ form.aliases }} {% trans "Separate multiple values with commas." %} - {% for error in form.aliases.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.aliases.errors id="desc_aliases" %}
{{ form.bio }} - {% for error in form.bio.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.bio.errors id="desc_bio" %}

{{ form.wikipedia_link }}

- {% for error in form.wikipedia_link.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.wikipedia_link.errors id="desc_wikipedia_link" %}
- {% for error in form.born.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.born.errors id="desc_born" %}
- {% for error in form.died.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.died.errors id="desc_died" %}
@@ -82,33 +76,29 @@
{{ form.openlibrary_key }} - {% for error in form.openlibrary_key.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.oepnlibrary_key.errors id="desc_oepnlibrary_key" %}
{{ form.inventaire_id }} - {% for error in form.inventaire_id.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.inventaire_id.errors id="desc_inventaire_id" %}
{{ form.librarything_key }} - {% for error in form.librarything_key.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.librarything_key.errors id="desc_librarything_key" %}
{{ form.goodreads_key }} - {% for error in form.goodreads_key.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.goodreads_key.errors id="desc_goodreads_key" %}
diff --git a/bookwyrm/templates/book/edit/edit_book_form.html b/bookwyrm/templates/book/edit/edit_book_form.html index 25d24e43d..fd2516a66 100644 --- a/bookwyrm/templates/book/edit/edit_book_form.html +++ b/bookwyrm/templates/book/edit/edit_book_form.html @@ -12,106 +12,125 @@
-

{% trans "Metadata" %}

+

+ {% trans "Metadata" %} +

- - - {% for error in form.title.errors %} -

{{ error | escape }}

- {% endfor %} + + + + {% include 'snippets/form_errors.html' with errors_list=form.title.errors id="desc_title" %}
- - - {% for error in form.subtitle.errors %} -

{{ error | escape }}

- {% endfor %} + + + + {% include 'snippets/form_errors.html' with errors_list=form.subtitle.errors id="desc_subtitle" %}
- + {{ form.description }} - {% for error in form.description.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.description.errors id="desc_description" %}
- - - {% for error in form.series.errors %} -

{{ error | escape }}

- {% endfor %} + + + + {% include 'snippets/form_errors.html' with errors_list=form.series.errors id="desc_series" %}
- + {{ form.series_number }} - {% for error in form.series_number.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.series_number.errors id="desc_series_number" %}
- + {{ form.languages }} - {% trans "Separate multiple values with commas." %} - {% for error in form.languages.errors %} -

{{ error | escape }}

- {% endfor %} + + {% trans "Separate multiple values with commas." %} + + + {% include 'snippets/form_errors.html' with errors_list=form.languages.errors id="desc_languages" %}
-

{% trans "Publication" %}

+

+ {% trans "Publication" %} +

- + {{ form.publishers }} - {% trans "Separate multiple values with commas." %} - {% for error in form.publishers.errors %} -

{{ error | escape }}

- {% endfor %} + + {% trans "Separate multiple values with commas." %} + + + {% include 'snippets/form_errors.html' with errors_list=form.publishers.errors id="desc_publishers" %}
- - - {% for error in form.first_published_date.errors %} -

{{ error | escape }}

- {% endfor %} + + + + {% include 'snippets/form_errors.html' with errors_list=form.first_published_date.errors id="desc_first_published_date" %}
- - - {% for error in form.published_date.errors %} -

{{ error | escape }}

- {% endfor %} + + + + {% include 'snippets/form_errors.html' with errors_list=form.published_date.errors id="desc_published_date" %}
-

{% trans "Authors" %}

+

+ {% trans "Authors" %} +

{% if book.authors.exists %}
{% for author in book.authors.all %}
-

+

{% blocktrans with name=author.name %}Author page for {{ name }}{% endblocktrans %}

@@ -119,7 +138,9 @@
{% endif %}
- + {% for author in add_author %} @@ -135,7 +156,9 @@
-

{% trans "Cover" %}

+

+ {% trans "Cover" %} +

{% if book.cover %} @@ -146,108 +169,122 @@
- + {{ form.cover }}
- +
- {% for error in form.cover.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.cover.errors id="desc_cover" %}
-

{% trans "Physical Properties" %}

+

+ {% trans "Physical Properties" %} +

- +
{{ form.physical_format }}
- {% for error in form.physical_format.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.physical_format.errors id="desc_physical_format" %}
- + {{ form.physical_format_detail }} - {% for error in form.physical_format_detail.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.physical_format_detail.errors id="desc_physical_format_detail" %}
- + {{ form.pages }} - {% for error in form.pages.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.pages.errors id="desc_pages" %}
-

{% trans "Book Identifiers" %}

+

+ {% trans "Book Identifiers" %} +

- + {{ form.isbn_13 }} - {% for error in form.isbn_13.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.isbn_13.errors id="desc_isbn_13" %}
- + {{ form.isbn_10 }} - {% for error in form.isbn_10.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.isbn_10.errors id="desc_isbn_10" %}
- + {{ form.openlibrary_key }} - {% for error in form.openlibrary_key.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.openlibrary_key.errors id="desc_openlibrary_key" %}
- + {{ form.inventaire_id }} - {% for error in form.inventaire_id.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.inventaire_id.errors id="desc_inventaire_id" %}
- + {{ form.oclc_number }} - {% for error in form.oclc_number.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.oclc_number.errors id="desc_oclc_number" %}
- + {{ form.asin }} - {% for error in form.ASIN.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.ASIN.errors id="desc_ASIN" %}
diff --git a/bookwyrm/templates/get_started/profile.html b/bookwyrm/templates/get_started/profile.html index 90cdb4104..ef33afac2 100644 --- a/bookwyrm/templates/get_started/profile.html +++ b/bookwyrm/templates/get_started/profile.html @@ -14,16 +14,14 @@
- {% for error in form.name.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.name.errors id="desc_name" %}
- {% for error in form.summary.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.summary.errors id="desc_summary" %}
@@ -31,9 +29,8 @@
{{ form.avatar }} - {% for error in form.avatar.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.avatar.errors id="desc_avatar" %}
diff --git a/bookwyrm/templates/landing/layout.html b/bookwyrm/templates/landing/layout.html index 0d6f231c1..56985768f 100644 --- a/bookwyrm/templates/landing/layout.html +++ b/bookwyrm/templates/landing/layout.html @@ -65,10 +65,9 @@ {% csrf_token %}
- - {% for error in request_form.email.errors %} -

{{ error|escape }}

- {% endfor %} + + + {% include 'snippets/form_errors.html' with errors_list=request_form.email.errors id="desc_request_email" %}
diff --git a/bookwyrm/templates/landing/login.html b/bookwyrm/templates/landing/login.html index 95baa06de..c9ac25261 100644 --- a/bookwyrm/templates/landing/login.html +++ b/bookwyrm/templates/landing/login.html @@ -26,11 +26,10 @@
- +
- {% for error in login_form.password.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=login_form.password.errors id="desc_password" %}
diff --git a/bookwyrm/templates/landing/password_reset.html b/bookwyrm/templates/landing/password_reset.html index be1dccf81..8348efd4f 100644 --- a/bookwyrm/templates/landing/password_reset.html +++ b/bookwyrm/templates/landing/password_reset.html @@ -8,21 +8,33 @@

{% trans "Reset Password" %}

- {% for error in errors %} -

{{ error }}

- {% endfor %} + + {% if errors %} +
+ {% for error in errors %} +

+ {{ error }} +

+ {% endfor %} +
+ + {% endif %}
{% csrf_token %}
- +
- +
- +
- +
diff --git a/bookwyrm/templates/preferences/delete_user.html b/bookwyrm/templates/preferences/delete_user.html index 63bd2f860..b009230c5 100644 --- a/bookwyrm/templates/preferences/delete_user.html +++ b/bookwyrm/templates/preferences/delete_user.html @@ -18,10 +18,9 @@ {% csrf_token %}
- - {% for error in form.password.errors %} -

{{ error | escape }}

- {% endfor %} + + + {% include 'snippets/form_errors.html' with errors_list=form.password.errors id="desc_password" %}
diff --git a/bookwyrm/templates/preferences/edit_user.html b/bookwyrm/templates/preferences/edit_user.html index 72c49dbe5..b18eb4e98 100644 --- a/bookwyrm/templates/preferences/edit_user.html +++ b/bookwyrm/templates/preferences/edit_user.html @@ -33,31 +33,27 @@ {% endif %}
{{ form.avatar }} - {% for error in form.avatar.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.avatar.errors id="desc_avatar" %}
{{ form.name }} - {% for error in form.name.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.name.errors id="desc_name" %}
{{ form.summary }} - {% for error in form.summary.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.summary.errors id="desc_summary" %}
{{ form.email }} - {% for error in form.email.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.email.errors id="desc_email" %}
@@ -69,19 +65,23 @@
+
+
+
+
{% url 'directory' as path %} -

+

{% blocktrans %}Your account will show up in the directory, and may be recommended to other BookWyrm users.{% endblocktrans %}

@@ -107,8 +107,8 @@
diff --git a/bookwyrm/templates/settings/announcements/announcement_form.html b/bookwyrm/templates/settings/announcements/announcement_form.html index ffdbfc2fd..8f68e2555 100644 --- a/bookwyrm/templates/settings/announcements/announcement_form.html +++ b/bookwyrm/templates/settings/announcements/announcement_form.html @@ -13,60 +13,68 @@ {% csrf_token %}

- + {{ form.preview }} - {% for error in form.preview.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.preview.errors id="desc_preview" %}

- + {{ form.content }} - {% for error in form.content.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.content.errors id="desc_content" %}

- + - {% for error in form.event_date.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.event_date.errors id="desc_event_date" %}

- + - {% for error in form.start_date.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.start_date.errors id="desc_start_date" %}

- + - {% for error in form.end_date.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.end_date.errors id="desc_end_date" %}

- + {{ form.active }} - {% for error in form.active.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=form.active.errors id="desc_active" %}

- +
{% endblock %} diff --git a/bookwyrm/templates/settings/email_blocklist/domain_form.html b/bookwyrm/templates/settings/email_blocklist/domain_form.html index e93337495..cebc97c85 100644 --- a/bookwyrm/templates/settings/email_blocklist/domain_form.html +++ b/bookwyrm/templates/settings/email_blocklist/domain_form.html @@ -17,10 +17,8 @@ {{ form.domain }}
- {% for error in form.domain.errors %} -

{{ error | escape }}

- {% endfor %} + {% include 'snippets/form_errors.html' with errors_list=form.domain.errors id="desc_domain" %}
diff --git a/bookwyrm/templates/settings/federation/edit_instance.html b/bookwyrm/templates/settings/federation/edit_instance.html index 7c2e6be66..0a67895cc 100644 --- a/bookwyrm/templates/settings/federation/edit_instance.html +++ b/bookwyrm/templates/settings/federation/edit_instance.html @@ -27,11 +27,12 @@
- - - {% for error in form.server_name.errors %} -

{{ error | escape }}

- {% endfor %} + + + + {% include 'snippets/form_errors.html' with errors_list=form.server_name.errors id="desc_server_name" %}
@@ -49,29 +50,37 @@
- - - {% for error in form.application_type.errors %} -

{{ error | escape }}

- {% endfor %} + + + + {% include 'snippets/form_errors.html' with errors_list=form.application_type.errors id="desc_application_type" %}
- - - {% for error in form.application_version.errors %} -

{{ error | escape }}

- {% endfor %} + + + + {% include 'snippets/form_errors.html' with errors_list=form.application_version.errors id="desc_application_version" %}
- - + +
- + {% endblock %} diff --git a/bookwyrm/templates/settings/ip_blocklist/ip_address_form.html b/bookwyrm/templates/settings/ip_blocklist/ip_address_form.html index c8a4c3e74..4a776987f 100644 --- a/bookwyrm/templates/settings/ip_blocklist/ip_address_form.html +++ b/bookwyrm/templates/settings/ip_blocklist/ip_address_form.html @@ -20,16 +20,16 @@
- +
- {% for error in form.address.errors %} -

{{ error | escape }}

- {% endfor %} + {% include 'snippets/form_errors.html' with errors_list=form.address.errors id="desc_address" %}
- +
diff --git a/bookwyrm/templates/settings/site.html b/bookwyrm/templates/settings/site.html index 94a4dd454..8efad308d 100644 --- a/bookwyrm/templates/settings/site.html +++ b/bookwyrm/templates/settings/site.html @@ -33,8 +33,8 @@ {{ site_form.instance_description }}
- -

{% trans "Used when the instance is previewed on joinbookwyrm.com. Does not support HTML or Markdown." %}

+ +

{% trans "Used when the instance is previewed on joinbookwyrm.com. Does not support HTML or Markdown." %}

{{ site_form.instance_short_description }}
@@ -114,7 +114,7 @@ {{ site_form.require_confirm_email }} {% trans "Require users to confirm email address" %} -

{% trans "(Recommended if registration is open)" %}

+

{% trans "(Recommended if registration is open)" %}

@@ -123,9 +123,8 @@
{{ site_form.invite_request_text }} - {% for error in site_form.invite_request_text.errors %} -

{{ error|escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=site_form.invite_request_text.errors id="desc_invite_request_text" %}
diff --git a/bookwyrm/templates/settings/users/delete_user_form.html b/bookwyrm/templates/settings/users/delete_user_form.html index 158745d05..1ea63269d 100644 --- a/bookwyrm/templates/settings/users/delete_user_form.html +++ b/bookwyrm/templates/settings/users/delete_user_form.html @@ -15,10 +15,9 @@

- - {% for error in form.password.errors %} -

{{ error | escape }}

- {% endfor %} + + + {% include 'snippets/form_errors.html' with errors_list=form.password.errors id="desc_password" %}
diff --git a/bookwyrm/templates/settings/users/user_moderation_actions.html b/bookwyrm/templates/settings/users/user_moderation_actions.html index a976359f4..b5f69529f 100644 --- a/bookwyrm/templates/settings/users/user_moderation_actions.html +++ b/bookwyrm/templates/settings/users/user_moderation_actions.html @@ -50,18 +50,23 @@ {% endif %} {% with group=user.groups.first %}
- {% for value, name in group_form.fields.groups.choices %} - + {% endfor %} - +
- {% for error in group_form.groups.errors %} -

{{ error | escape }}

- {% endfor %} + + {% include 'snippets/form_errors.html' with errors_list=group_form.groups.errors id="desc_user_group" %} {% endwith %} - +
{% endif %} diff --git a/bookwyrm/templates/snippets/form_errors.html b/bookwyrm/templates/snippets/form_errors.html new file mode 100644 index 000000000..ecbf7ff8d --- /dev/null +++ b/bookwyrm/templates/snippets/form_errors.html @@ -0,0 +1,9 @@ +{% if errors_list %} +
+ {% for error in errors_list %} +

+ {{ error | escape }} +

+ {% endfor %} +
+{% endif %} diff --git a/bookwyrm/templates/snippets/register_form.html b/bookwyrm/templates/snippets/register_form.html index 9e610bd13..a1af78eff 100644 --- a/bookwyrm/templates/snippets/register_form.html +++ b/bookwyrm/templates/snippets/register_form.html @@ -3,32 +3,31 @@
- + + + {% include 'snippets/form_errors.html' with errors_list=register_form.localname.errors id="desc_localname_register" %}
- {% for error in register_form.localname.errors %} -

{{ error | escape }}

- {% endfor %}
- - {% for error in register_form.email.errors %} -

{{ error | escape }}

- {% endfor %} + + + {% include 'snippets/form_errors.html' with errors_list=register_form.email.errors id="desc_email_register" %}
- - {% for error in register_form.password.errors %} -

{{ error | escape }}

- {% endfor %} + + + {% include 'snippets/form_errors.html' with errors_list=register_form.password.errors id="desc_password_register" %}
- +