From 0fe5cb1000fce84d5f244ae78839fcee1d85444e Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 18 Sep 2021 11:56:32 -0700 Subject: [PATCH 01/23] Show label for content warning field --- .../create_status/content_warning_field.html | 12 ++++++-- .../snippets/create_status/layout.html | 28 ++++++++----------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/bookwyrm/templates/snippets/create_status/content_warning_field.html b/bookwyrm/templates/snippets/create_status/content_warning_field.html index 86b40ae23..d95e19112 100644 --- a/bookwyrm/templates/snippets/create_status/content_warning_field.html +++ b/bookwyrm/templates/snippets/create_status/content_warning_field.html @@ -1,6 +1,14 @@ {% load i18n %} -
- +
+ {% endblock %} + {% include "snippets/create_status/content_warning_field.html" %} + + {# fields that go between the content warnings and the content field (ie, quote) #} + {% block pre_content_additions %}{% endblock %} + + +
-
- {% include "snippets/create_status/content_warning_field.html" %} -
- - {# fields that go between the content warnings and the content field (ie, quote) #} - {% block pre_content_additions %}{% endblock %} - - - -
- {% include "snippets/create_status/content_field.html" with placeholder=placeholder %} -
+ {% include "snippets/create_status/content_field.html" with placeholder=placeholder %}
{# additional fields that go after the content block (ie, progress) #} From 19e36eb181c1593f8781bcf00be633ebcdfa04b7 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 18 Sep 2021 14:05:17 -0700 Subject: [PATCH 02/23] Fixes content warning fields in modals --- .../snippets/create_status/content_warning_field.html | 6 +++--- .../snippets/create_status/content_warning_toggle.html | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bookwyrm/templates/snippets/create_status/content_warning_field.html b/bookwyrm/templates/snippets/create_status/content_warning_field.html index d95e19112..5ed1fad14 100644 --- a/bookwyrm/templates/snippets/create_status/content_warning_field.html +++ b/bookwyrm/templates/snippets/create_status/content_warning_field.html @@ -1,11 +1,11 @@ {% load i18n %}
@@ -14,7 +14,7 @@ name="content_warning" maxlength="255" class="input" - id="id_content_warning_{{ uuid }}" + id="id_content_warning_{{ uuid }}{{ local_uuid }}" placeholder="{% trans 'Spoilers ahead!' %}" value="{% firstof draft.content_warning parent_status.content_warning '' %}" data-cache-draft="id_content_warning_{{ book.id }}_{{ type }}" diff --git a/bookwyrm/templates/snippets/create_status/content_warning_toggle.html b/bookwyrm/templates/snippets/create_status/content_warning_toggle.html index 1c7676db1..f29d47c45 100644 --- a/bookwyrm/templates/snippets/create_status/content_warning_toggle.html +++ b/bookwyrm/templates/snippets/create_status/content_warning_toggle.html @@ -5,12 +5,13 @@ type="checkbox" class="is-hidden" name="sensitive" - id="id_show_spoilers_{{ uuid }}" + id="id_show_spoilers_{{ uuid }}{{ local_uuid }}" {% if draft.content_warning or status.content_warning %}checked{% endif %} aria-hidden="true" data-cache-draft="id_sensitive_{{ book.id }}_{{ type }}{{ reply_parent.id }}" > {% trans "Include spoiler alert" as button_text %} {% firstof draft.content_warning status.content_warning as pressed %} - {% include 'snippets/toggle/toggle_button.html' with text=button_text icon="warning is-size-4" controls_text="spoilers" controls_uid=uuid focus="id_content_warning" checkbox="id_show_spoilers" class="toggle-button" pressed=pressed %} + {% firstof local_uuid '' as local_uuid %} + {% include 'snippets/toggle/toggle_button.html' with text=button_text icon="warning is-size-4" controls_text="spoilers" controls_uid=uuid|add:local_uuid focus="id_content_warning" checkbox="id_show_spoilers" class="toggle-button" pressed=pressed %}
From 293962326c3c808e8f75c1523a94b313755479e3 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 18 Sep 2021 14:32:30 -0700 Subject: [PATCH 03/23] Tick javascript hash --- bookwyrm/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py index cf33c129b..cdf700ec2 100644 --- a/bookwyrm/settings.py +++ b/bookwyrm/settings.py @@ -13,7 +13,7 @@ VERSION = "0.0.1" PAGE_LENGTH = env("PAGE_LENGTH", 15) DEFAULT_LANGUAGE = env("DEFAULT_LANGUAGE", "English") -JS_CACHE = "e5832a26" +JS_CACHE = "7f2343cf" # email EMAIL_BACKEND = env("EMAIL_BACKEND", "django.core.mail.backends.smtp.EmailBackend") From dda36f22c285b57a2dc467fae4cd0996433249dc Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 18 Sep 2021 14:48:03 -0700 Subject: [PATCH 04/23] Fixes select all checkbox --- bookwyrm/templates/import/import_status.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/templates/import/import_status.html b/bookwyrm/templates/import/import_status.html index 1c425af6e..1c0739444 100644 --- a/bookwyrm/templates/import/import_status.html +++ b/bookwyrm/templates/import/import_status.html @@ -77,7 +77,7 @@ class="checkbox" type="checkbox" data-action="toggle-all" - data-target="failed-imports" + data-target="failed_imports" /> {% trans "Select all" %} From 01ffb8d77b1999107380e4bcd0976e69bc1e0e94 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 18 Sep 2021 14:56:20 -0700 Subject: [PATCH 05/23] Fixes form submission from compose view --- bookwyrm/templates/compose.html | 2 +- bookwyrm/templates/snippets/create_status/layout.html | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bookwyrm/templates/compose.html b/bookwyrm/templates/compose.html index e37ec170e..3a222cf6a 100644 --- a/bookwyrm/templates/compose.html +++ b/bookwyrm/templates/compose.html @@ -27,7 +27,7 @@ {% if not draft %} {% include 'snippets/create_status.html' %} {% else %} - {% include 'snippets/create_status/status.html' %} + {% include 'snippets/create_status/status.html' with no_script=True %} {% endif %}
diff --git a/bookwyrm/templates/snippets/create_status/layout.html b/bookwyrm/templates/snippets/create_status/layout.html index d62456b89..1e10085c0 100644 --- a/bookwyrm/templates/snippets/create_status/layout.html +++ b/bookwyrm/templates/snippets/create_status/layout.html @@ -14,7 +14,13 @@ reply_parent: the Status object this post will be in reply to, if applicable {% block form_open %} {# default form tag syntax, can be overriddden #} -
+ {% endblock %} {% csrf_token %} From 385da1ea430f3e2492a32b453989f2d4896dc5e9 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 18 Sep 2021 15:08:02 -0700 Subject: [PATCH 06/23] Handle get request to /register path --- bookwyrm/views/register.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bookwyrm/views/register.py b/bookwyrm/views/register.py index 1a0615ac0..202e2089d 100644 --- a/bookwyrm/views/register.py +++ b/bookwyrm/views/register.py @@ -16,6 +16,11 @@ from bookwyrm.settings import DOMAIN class Register(View): """register a user""" + def get(self, request): # pylint: disable=unused-argument + """whether or not you're logged in, just go to the home view""" + return redirect("/") + + @sensitive_variables("password") @method_decorator(sensitive_post_parameters("password")) def post(self, request): From 246ab992ae1f4ae6fd8eee6678dbff2575af2908 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 18 Sep 2021 15:10:25 -0700 Subject: [PATCH 07/23] Consistent layout for invite registration page --- bookwyrm/templates/invite.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bookwyrm/templates/invite.html b/bookwyrm/templates/invite.html index 22a3a32ca..fcd379e26 100644 --- a/bookwyrm/templates/invite.html +++ b/bookwyrm/templates/invite.html @@ -5,11 +5,11 @@ {% block content %} +

{% trans "Create an Account" %}

{% if valid %} -

{% trans "Create an Account" %}

@@ -25,7 +25,7 @@
-
+
{% include 'snippets/about.html' %}
From 1be4f31a9e07ca24badd3598d0ecdf3c23220054 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 18 Sep 2021 15:15:48 -0700 Subject: [PATCH 08/23] Cleans up display of login page --- bookwyrm/templates/login.html | 96 +++++++++++++++++------------------ 1 file changed, 46 insertions(+), 50 deletions(-) diff --git a/bookwyrm/templates/login.html b/bookwyrm/templates/login.html index 19c103eac..31e9cebb4 100644 --- a/bookwyrm/templates/login.html +++ b/bookwyrm/templates/login.html @@ -4,69 +4,65 @@ {% block title %}{% trans "Login" %}{% endblock %} {% block content %} -
-
-
-

{% trans "Log in" %}

- {% if login_form.non_field_errors %} -

{{ login_form.non_field_errors }}

- {% endif %} +

{% trans "Log in" %}

+
+
+ {% if login_form.non_field_errors %} +

{{ login_form.non_field_errors }}

+ {% endif %} - {% if show_confirmed_email %} -

{% trans "Success! Email address confirmed." %}

- {% endif %} - - {% csrf_token %} - {% if show_confirmed_email %}{% endif %} -
- -
- {{ login_form.localname }} -
+ {% if show_confirmed_email %} +

{% trans "Success! Email address confirmed." %}

+ {% endif %} + + {% csrf_token %} + {% if show_confirmed_email %}{% endif %} +
+ +
+ {{ login_form.localname }}
-
- -
- {{ login_form.password }} -
- {% for error in login_form.password.errors %} -

{{ error | escape }}

- {% endfor %} +
+
+ +
+ {{ login_form.password }}
-
-
- -
- + {% for error in login_form.password.errors %} +

{{ error | escape }}

+ {% endfor %} +
+
+
+
- -
+ +
+
-
+ {% if site.allow_registration %} +
- {% if site.allow_registration %}

{% trans "Create an Account" %}

{% include 'snippets/register_form.html' %}
- {% else %} -

{% trans "This instance is closed" %}

-

{% trans "Contact an administrator to get an invite" %}

- {% endif %} +
+
+ {% endif %} + +
+
+ {% include 'snippets/about.html' %} + +

+ {% trans "More about this site" %} +

-
-
- {% include 'snippets/about.html' %} - -

- {% trans "More about this site" %} -

-
-
{% endblock %} From 38c66b208c4e5fca6b3a7de2c121505b2847fcf0 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 18 Sep 2021 15:42:48 -0700 Subject: [PATCH 09/23] Adds customizable invite request copy --- .../migrations/0098_auto_20210918_2238.py | 27 ++++++++ bookwyrm/models/site.py | 5 +- .../templates/landing/landing_layout.html | 63 ++++++++++--------- bookwyrm/templates/settings/site.html | 7 +++ bookwyrm/views/register.py | 1 - 5 files changed, 71 insertions(+), 32 deletions(-) create mode 100644 bookwyrm/migrations/0098_auto_20210918_2238.py diff --git a/bookwyrm/migrations/0098_auto_20210918_2238.py b/bookwyrm/migrations/0098_auto_20210918_2238.py new file mode 100644 index 000000000..09fdba317 --- /dev/null +++ b/bookwyrm/migrations/0098_auto_20210918_2238.py @@ -0,0 +1,27 @@ +# Generated by Django 3.2.4 on 2021-09-18 22:38 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("bookwyrm", "0097_auto_20210917_1858"), + ] + + operations = [ + migrations.AddField( + model_name="sitesettings", + name="invite_request_text", + field=models.TextField( + default="If your request is approved, you will receive an email with a registration link." + ), + ), + migrations.AlterField( + model_name="sitesettings", + name="registration_closed_text", + field=models.TextField( + default='We aren\'t taking new users at this time. You can find an open instance at joinbookwyrm.com/instances.' + ), + ), + ] diff --git a/bookwyrm/models/site.py b/bookwyrm/models/site.py index ee69a507f..4646c0c7a 100644 --- a/bookwyrm/models/site.py +++ b/bookwyrm/models/site.py @@ -24,7 +24,10 @@ class SiteSettings(models.Model): # about page registration_closed_text = models.TextField( - default="Contact an administrator to get an invite" + default='We aren\'t taking new users at this time. You can find an open instance at joinbookwyrm.com/instances.' + ) + invite_request_text = models.TextField( + default="If your request is approved, you will receive an email with a registration link." ) code_of_conduct = models.TextField(default="Add a code of conduct here.") privacy_policy = models.TextField(default="Add a privacy policy here.") diff --git a/bookwyrm/templates/landing/landing_layout.html b/bookwyrm/templates/landing/landing_layout.html index 946482cbb..7397d1620 100644 --- a/bookwyrm/templates/landing/landing_layout.html +++ b/bookwyrm/templates/landing/landing_layout.html @@ -40,38 +40,41 @@
{% if not request.user.is_authenticated %}
+

+ {% if site.allow_registration %} + {% blocktrans with name=site.name %}Join {{ name }}{% endblocktrans %} + {% elif site.allow_invite_requests %} + {% trans "Request an Invitation" %} + {% else %} + {% blocktrans with name=site.name%}{{ name}} registration is closed{% endblocktrans %} + {% endif %} +

+ {% if site.allow_registration %} -

{% blocktrans with name=site.name %}Join {{ name }}{% endblocktrans %}

-
- {% include 'snippets/register_form.html' %} -
- +
+ {% include 'snippets/register_form.html' %} +
+ {% elif site.allow_invite_requests %} + {% if request_received %} +

+ {% trans "Thank you! Your request has been received." %} +

+ {% else %} +

{{ site.invite_request_text }}

+

+ {% csrf_token %} +
+ + + {% for error in request_form.email.errors %} +

{{ error|escape }}

+ {% endfor %} +
+ +
+ {% endif %} {% else %} - -

{% trans "This instance is closed" %}

-

{{ site.registration_closed_text|safe}}

- - {% if site.allow_invite_requests %} - {% if request_received %} -

- {% trans "Thank you! Your request has been received." %} -

- {% else %} -

{% trans "Request an Invitation" %}

-
- {% csrf_token %} -
- - - {% for error in request_form.email.errors %} -

{{ error|escape }}

- {% endfor %} -
- -
- {% endif %} - {% endif %} - +

{{ site.registration_closed_text|safe}}

{% endif %}
{% else %} diff --git a/bookwyrm/templates/settings/site.html b/bookwyrm/templates/settings/site.html index 945e5749b..508954857 100644 --- a/bookwyrm/templates/settings/site.html +++ b/bookwyrm/templates/settings/site.html @@ -107,6 +107,13 @@ {{ site_form.registration_closed_text }}
+
+ + {{ site_form.invite_request_text }} + {% for error in site_form.invite_request_text.errors %} +

{{ error|escape }}

+ {% endfor %} +