diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index 96a4e3030..24e0c21e9 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -299,6 +299,12 @@ class ReportForm(CustomForm): fields = ["user", "reporter", "statuses", "note"] +class EmailBlocklistForm(CustomForm): + class Meta: + model = models.EmailBlocklist + fields = ["domain"] + + class ServerForm(CustomForm): class Meta: model = models.FederatedServer diff --git a/bookwyrm/models/__init__.py b/bookwyrm/models/__init__.py index 6f378e83c..e8e1b696e 100644 --- a/bookwyrm/models/__init__.py +++ b/bookwyrm/models/__init__.py @@ -24,7 +24,9 @@ from .federated_server import FederatedServer from .import_job import ImportJob, ImportItem -from .site import SiteSettings, SiteInvite, PasswordReset, InviteRequest +from .site import SiteSettings, SiteInvite +from .site import PasswordReset, InviteRequest +from .site import EmailBlocklist from .announcement import Announcement cls_members = inspect.getmembers(sys.modules[__name__], inspect.isclass) diff --git a/bookwyrm/templates/settings/announcement_form.html b/bookwyrm/templates/settings/announcement_form.html index 8eb6acd52..ffdbfc2fd 100644 --- a/bookwyrm/templates/settings/announcement_form.html +++ b/bookwyrm/templates/settings/announcement_form.html @@ -13,21 +13,21 @@ {% csrf_token %}
- + {{ form.preview }} {% for error in form.preview.errors %}
{{ error | escape }}
{% endfor %}- + {{ form.content }} {% for error in form.content.errors %}
{{ error | escape }}
{% endfor %}- + {% for error in form.event_date.errors %}
{{ error | escape }}
@@ -37,7 +37,7 @@- + {% for error in form.start_date.errors %}
{{ error | escape }}
@@ -46,7 +46,7 @@- + {% for error in form.end_date.errors %}
{{ error | escape }}
@@ -55,7 +55,7 @@- + {{ form.active }} {% for error in form.active.errors %}
{{ error | escape }}
diff --git a/bookwyrm/templates/settings/domain_form.html b/bookwyrm/templates/settings/domain_form.html new file mode 100644 index 000000000..e40a0d542 --- /dev/null +++ b/bookwyrm/templates/settings/domain_form.html @@ -0,0 +1,25 @@ +{% extends 'components/inline_form.html' %} +{% load i18n %} + +{% block header %} +{% trans "Add domain" %} +{% endblock %} + +{% block form %} + +{% endblock %} diff --git a/bookwyrm/templates/settings/email_blocklist.html b/bookwyrm/templates/settings/email_blocklist.html index 62561f747..54779854a 100644 --- a/bookwyrm/templates/settings/email_blocklist.html +++ b/bookwyrm/templates/settings/email_blocklist.html @@ -5,13 +5,18 @@ {% block header %}{% trans "Email Blocklist" %}{% endblock %} {% block edit-button %} - - - {% trans "Add domain" %} +{% trans "Add domain" as button_text %} +{% include 'snippets/toggle/open_button.html' with controls_text="add_domain" icon_with_text="plus" text=button_text focus="add_domain_header" %} {% endblock %} {% block panel %} +{% include 'settings/domain_form.html' with controls_text="add_domain" class="block" %} + ++ {% trans "When someone tries to register with an email from this domain, no account will be created. The registration process will appear to have worked." %} +
+gmail.com | +{{ domain.domain }} | {% trans "Delete" as button_text %} |