diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index 847ca05c..aed5a794 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 class CustomForm(ModelForm): @@ -147,6 +148,23 @@ 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): @@ -160,6 +178,20 @@ 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): @@ -288,6 +320,17 @@ 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): diff --git a/bookwyrm/templates/preferences/delete_user.html b/bookwyrm/templates/preferences/delete_user.html index 63bd2f86..a72cc97d 100644 --- a/bookwyrm/templates/preferences/delete_user.html +++ b/bookwyrm/templates/preferences/delete_user.html @@ -18,9 +18,9 @@ {% csrf_token %}
- + {% for error in form.password.errors %} -

{{ error | escape }}

+

{{ error | escape }}

{% endfor %}
diff --git a/bookwyrm/templates/preferences/edit_user.html b/bookwyrm/templates/preferences/edit_user.html index 72c49dbe..a3f8962c 100644 --- a/bookwyrm/templates/preferences/edit_user.html +++ b/bookwyrm/templates/preferences/edit_user.html @@ -34,7 +34,7 @@
{{ form.avatar }} {% for error in form.avatar.errors %} -

{{ error | escape }}

+

{{ error | escape }}

{% endfor %}
@@ -42,21 +42,21 @@ {{ form.name }} {% for error in form.name.errors %} -

{{ error | escape }}

+

{{ error | escape }}

{% endfor %}
{{ form.summary }} {% for error in form.summary.errors %} -

{{ error | escape }}

+

{{ error | escape }}

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

{{ error | escape }}

+

{{ error | escape }}

{% endfor %}
@@ -69,19 +69,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 +111,8 @@
diff --git a/bookwyrm/templates/settings/site.html b/bookwyrm/templates/settings/site.html index 94a4dd45..01b25036 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)" %}

@@ -124,7 +124,7 @@ {{ site_form.invite_request_text }} {% for error in site_form.invite_request_text.errors %} -

{{ error|escape }}

+

{{ error|escape }}

{% endfor %}