From 9d52e3cf273e1fa97051b23fbc4508b2fb574005 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Sat, 27 Nov 2021 18:32:50 +1100 Subject: [PATCH 01/98] add ostatus subscribe to webfinger links --- bookwyrm/views/wellknown.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bookwyrm/views/wellknown.py b/bookwyrm/views/wellknown.py index 04aa88bf2..c9b1c1299 100644 --- a/bookwyrm/views/wellknown.py +++ b/bookwyrm/views/wellknown.py @@ -30,6 +30,10 @@ def webfinger(request): "rel": "self", "type": "application/activity+json", "href": user.remote_id, + }, + { + "rel": "http://ostatus.org/schema/1.0/subscribe", + "template": f"https://{DOMAIN}/ostatus_subscribe?acct={{uri}}" } ], } From f7c8f121b9c95f0c4ef7e68a358736f1dd209067 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Sun, 28 Nov 2021 12:43:29 +1100 Subject: [PATCH 02/98] add remote follow ostatus templates --- bookwyrm/templates/ostatus/ostatus_error.html | 57 ++++++++++ .../templates/ostatus/ostatus_subscribe.html | 48 ++++++++ bookwyrm/templates/ostatus/template.html | 106 ++++++++++++++++++ 3 files changed, 211 insertions(+) create mode 100644 bookwyrm/templates/ostatus/ostatus_error.html create mode 100644 bookwyrm/templates/ostatus/ostatus_subscribe.html create mode 100644 bookwyrm/templates/ostatus/template.html diff --git a/bookwyrm/templates/ostatus/ostatus_error.html b/bookwyrm/templates/ostatus/ostatus_error.html new file mode 100644 index 000000000..5fbc8e945 --- /dev/null +++ b/bookwyrm/templates/ostatus/ostatus_error.html @@ -0,0 +1,57 @@ +{% extends 'ostatus/template.html' %} +{% load i18n %} +{% load utilities %} +{% load markdown %} + +{% block title %} +{% if not request.user.is_authenticated %} +{% trans "Log in to " %} +{% else %} +{% trans "Error following from " %} +{% endif %} +{% endblock %} + +{% block heading %} +{% if not request.user.is_authenticated %} +Let's log in first... +{% else %} +Uh oh... +{% endif %} +{% endblock %} + +{% block content %} +
+ {% if not request.user.is_authenticated %} + + {% elif error == 'ostatus_subscribe' %} +
+

{% blocktrans %}Something went wrong trying to follow {{ account }}{% endblocktrans %}

+

{% trans 'Check you have the correct username before trying again.' %}

+
+ {% endif %} +
+{% endblock %} diff --git a/bookwyrm/templates/ostatus/ostatus_subscribe.html b/bookwyrm/templates/ostatus/ostatus_subscribe.html new file mode 100644 index 000000000..7e929202e --- /dev/null +++ b/bookwyrm/templates/ostatus/ostatus_subscribe.html @@ -0,0 +1,48 @@ +{% extends 'ostatus/template.html' %} +{% load i18n %} +{% load utilities %} +{% load markdown %} + +{% if error or not request.user.is_authenticated %} + {% include 'ostatus/ostatus_error.html' %} +{% else %} + +{% block title %}{% trans "Follow from " %}{% endblock %} + +{% block heading %}Follow from {{ site.name }}{% endblock %} + +{% block content %} +
+
+ +
+ {% if user.summary %} + {{ user.summary|to_markdown|safe|truncatechars_html:120 }} + {% else %} {% endif %} +
+
+
+{% endblock %} + +{% endif %} diff --git a/bookwyrm/templates/ostatus/template.html b/bookwyrm/templates/ostatus/template.html new file mode 100644 index 000000000..2e8ee7b3c --- /dev/null +++ b/bookwyrm/templates/ostatus/template.html @@ -0,0 +1,106 @@ +{% load layout %} +{% load i18n %} +{% load static %} +{% load utilities %} +{% load markdown %} + + + + + {% block title %}{% endblock %}{{ site.name }} + + + + + + + + + + {% if preview_images_enabled is True %} + + {% else %} + + {% endif %} + + + + + + {% block opengraph_images %} + {% include 'snippets/opengraph_images.html' %} + {% endblock %} + + + + + + + +
+
+ {% block content%}{% endblock %} +
+
+ + + + + + + + + + + +{% block scripts %}{% endblock %} + + From d05e100421eaf53946e6cd420b2d32f45b35ab2f Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Sun, 28 Nov 2021 13:28:58 +1100 Subject: [PATCH 03/98] update ostatus templates --- bookwyrm/templates/ostatus/ostatus_error.html | 19 ------------- .../templates/ostatus/ostatus_subscribe.html | 28 ++++++++++++++----- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/bookwyrm/templates/ostatus/ostatus_error.html b/bookwyrm/templates/ostatus/ostatus_error.html index 5fbc8e945..de2ba988b 100644 --- a/bookwyrm/templates/ostatus/ostatus_error.html +++ b/bookwyrm/templates/ostatus/ostatus_error.html @@ -1,23 +1,4 @@ -{% extends 'ostatus/template.html' %} {% load i18n %} -{% load utilities %} -{% load markdown %} - -{% block title %} -{% if not request.user.is_authenticated %} -{% trans "Log in to " %} -{% else %} -{% trans "Error following from " %} -{% endif %} -{% endblock %} - -{% block heading %} -{% if not request.user.is_authenticated %} -Let's log in first... -{% else %} -Uh oh... -{% endif %} -{% endblock %} {% block content %}
diff --git a/bookwyrm/templates/ostatus/ostatus_subscribe.html b/bookwyrm/templates/ostatus/ostatus_subscribe.html index 7e929202e..9d87d8ef8 100644 --- a/bookwyrm/templates/ostatus/ostatus_subscribe.html +++ b/bookwyrm/templates/ostatus/ostatus_subscribe.html @@ -3,15 +3,30 @@ {% load utilities %} {% load markdown %} -{% if error or not request.user.is_authenticated %} - {% include 'ostatus/ostatus_error.html' %} +{% block title %} +{% if not request.user.is_authenticated %} +{% trans "Log in to " %} +{% elif error %} +{% trans "Error following from " %} {% else %} +{% trans "Follow from " %} +{% endif %} +{% endblock %} -{% block title %}{% trans "Follow from " %}{% endblock %} - -{% block heading %}Follow from {{ site.name }}{% endblock %} +{% block heading %} +{% if not request.user.is_authenticated %} +{% trans "Let's log in first..." %} +{% elif error %} +{% trans 'Uh oh...' %} +{% else %} +{% blocktrans %}Follow from {{ site.name }}{% endblocktrans %} +{% endif %} +{% endblock %} {% block content %} +{% if error or not request.user.is_authenticated %} + {% include 'ostatus/ostatus_error.html' with error=error user=user account=account %} +{% else %}
@@ -43,6 +58,5 @@
-{% endblock %} - {% endif %} +{% endblock %} From 610114b4ebfcd27cde9f76244d559c226e4d78b5 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Sun, 28 Nov 2021 16:54:25 +1100 Subject: [PATCH 04/98] rearrange ostatus templates --- .../{ostatus_error.html => error.html} | 14 +++++++- ...{ostatus_subscribe.html => subscribe.html} | 7 ++-- bookwyrm/templates/ostatus/success.html | 32 +++++++++++++++++++ 3 files changed, 49 insertions(+), 4 deletions(-) rename bookwyrm/templates/ostatus/{ostatus_error.html => error.html} (71%) rename bookwyrm/templates/ostatus/{ostatus_subscribe.html => subscribe.html} (86%) create mode 100644 bookwyrm/templates/ostatus/success.html diff --git a/bookwyrm/templates/ostatus/ostatus_error.html b/bookwyrm/templates/ostatus/error.html similarity index 71% rename from bookwyrm/templates/ostatus/ostatus_error.html rename to bookwyrm/templates/ostatus/error.html index de2ba988b..b6e858e24 100644 --- a/bookwyrm/templates/ostatus/ostatus_error.html +++ b/bookwyrm/templates/ostatus/error.html @@ -29,10 +29,22 @@
{% elif error == 'ostatus_subscribe' %} -
+

{% blocktrans %}Something went wrong trying to follow {{ account }}{% endblocktrans %}

{% trans 'Check you have the correct username before trying again.' %}

+ {% elif error == 'is_blocked' %} +
+

{% blocktrans %}You have blocked {{ account }}{% endblocktrans %}

+
+ {% elif error == 'already_following' %} +
+

{% blocktrans %}You are already following {{ account }}{% endblocktrans %}

+
+ {% elif error == 'already_requested' %} +
+

{% blocktrans %}You have already requested to follow {{ account }}{% endblocktrans %}

+
{% endif %}
{% endblock %} diff --git a/bookwyrm/templates/ostatus/ostatus_subscribe.html b/bookwyrm/templates/ostatus/subscribe.html similarity index 86% rename from bookwyrm/templates/ostatus/ostatus_subscribe.html rename to bookwyrm/templates/ostatus/subscribe.html index 9d87d8ef8..e64be6029 100644 --- a/bookwyrm/templates/ostatus/ostatus_subscribe.html +++ b/bookwyrm/templates/ostatus/subscribe.html @@ -25,7 +25,7 @@ {% block content %} {% if error or not request.user.is_authenticated %} - {% include 'ostatus/ostatus_error.html' with error=error user=user account=account %} + {% include 'ostatus/error.html' with error=error user=user account=account %} {% else %}
@@ -45,13 +45,14 @@ @{{ user|username }} -
+ {% csrf_token %} +
-
+
{% if user.summary %} {{ user.summary|to_markdown|safe|truncatechars_html:120 }} {% else %} {% endif %} diff --git a/bookwyrm/templates/ostatus/success.html b/bookwyrm/templates/ostatus/success.html new file mode 100644 index 000000000..10b4409f3 --- /dev/null +++ b/bookwyrm/templates/ostatus/success.html @@ -0,0 +1,32 @@ +{% extends 'ostatus/template.html' %} +{% load i18n %} +{% load utilities %} + +{% block content %} + +{% endblock %} From e275b98183cdaed4e33d3e11e51307aa63187def Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Sun, 28 Nov 2021 16:56:21 +1100 Subject: [PATCH 05/98] ostatus remote follow views --- bookwyrm/urls.py | 3 ++ bookwyrm/views/__init__.py | 2 +- bookwyrm/views/follow.py | 82 +++++++++++++++++++++++++++++++++++++- 3 files changed, 85 insertions(+), 2 deletions(-) diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index 514bb7e60..79e6e2a98 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -44,6 +44,7 @@ urlpatterns = [ re_path(r"^api/v1/instance/?$", views.instance_info), re_path(r"^api/v1/instance/peers/?$", views.peers), re_path(r"^opensearch.xml$", views.opensearch, name="opensearch"), + re_path(r"^ostatus_subscribe/?$", views.ostatus_follow_request), # polling updates re_path("^api/updates/notifications/?$", views.get_notification_count), re_path("^api/updates/stream/(?P[a-z]+)/?$", views.get_unread_status_count), @@ -450,4 +451,6 @@ urlpatterns = [ re_path(r"^unfollow/?$", views.unfollow, name="unfollow"), re_path(r"^accept-follow-request/?$", views.accept_follow_request), re_path(r"^delete-follow-request/?$", views.delete_follow_request), + # re_path(r"^ostatus_follow/?$", views.remote_follow), + re_path(r"^ostatus_success/?$", views.ostatus_follow_success, name="ostatus-success"), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/bookwyrm/views/__init__.py b/bookwyrm/views/__init__.py index d79de4248..034b1830a 100644 --- a/bookwyrm/views/__init__.py +++ b/bookwyrm/views/__init__.py @@ -58,7 +58,7 @@ from .author import Author, EditAuthor from .directory import Directory from .discover import Discover from .feed import DirectMessage, Feed, Replies, Status -from .follow import follow, unfollow +from .follow import follow, unfollow, ostatus_follow_request, ostatus_follow_success from .follow import accept_follow_request, delete_follow_request from .get_started import GetStartedBooks, GetStartedProfile, GetStartedUsers from .goal import Goal, hide_goal diff --git a/bookwyrm/views/follow.py b/bookwyrm/views/follow.py index 7d91ce5b4..471fe3079 100644 --- a/bookwyrm/views/follow.py +++ b/bookwyrm/views/follow.py @@ -1,11 +1,14 @@ """ views for actions you can take in the application """ +import urllib.parse +import re from django.contrib.auth.decorators import login_required from django.db import IntegrityError from django.shortcuts import get_object_or_404, redirect +from django.template.response import TemplateResponse from django.views.decorators.http import require_POST from bookwyrm import models -from .helpers import get_user_from_username +from .helpers import get_user_from_username, handle_remote_webfinger @login_required @@ -23,9 +26,13 @@ def follow(request): except IntegrityError: pass + if request.GET.get("next"): + return redirect(request.GET.get("next", "/")) + return redirect(to_follow.local_path) + @login_required @require_POST def unfollow(request): @@ -84,3 +91,76 @@ def delete_follow_request(request): follow_request.delete() return redirect(f"/user/{request.user.localname}") + +def ostatus_follow_request(request): + """prepare an outgoing remote follow request""" + + # parse the acct URI into a user string + uri = urllib.parse.unquote(request.GET.get("acct")) + username_parts = re.search("(?:^http(?:s?):\/\/)([\w\-\.]*)(?:.)*(?:(?:\/)([\w]*))", uri) + account = f"{username_parts[2]}@{username_parts[1]}" + user = handle_remote_webfinger(account) + error = None + + if user is None or user == "": + error = "ostatus_subscribe" + + if bool(user) and user in request.user.blocks.all(): + error = "is_blocked" + + if hasattr(user, "followers") and request.user in user.followers.all(): + error = "already_following" + + if hasattr(user, "follower_requests") and request.user in user.follower_requests.all(): + error = "already_requested" + + data = { + "account": account, + "user": user, + "error": error + } + + return TemplateResponse(request, "ostatus/subscribe.html", data) + + +@login_required +def ostatus_follow_success(request): + """display success message for remote follow""" + user = get_user_from_username(request.user, request.GET.get("following")) + data = { + "account": user.name, + "user": user, + "error": None + } + return TemplateResponse(request, "ostatus/success.html", data) + +@login_required +@require_POST +def remote_follow(request): + """complete an incoming remote follow request""" + + # this is triggered from remote follow form + # attempt the follow request + # on success [[return success page]] + # on fail return [[ostatus_error]] + + +""" +REQUEST TO FOLLOW FROM REMOTE ACCOUNT +1. click remote follow button [default checked option to open new window] +2. popup new small window +3. enter user acct to follow from (user@domain.tld) and submit form +5. GET {base_url}/.well-known/webfinger/?resource=acct:{user@domain.tld} +6. parse json for links +6.1 rel="http://ostatus.org/schema/1.0/subscribe" and return 'template' +6.2 rel="self" and return href +7. replace '{uri}' in the returned string with self.href +8. GET the URI at 6.1 + +REQUEST TO FOLLOW FROM LOCAL ACCOUNT +1. receive request to /ostatus_subscribe?acct={uri} +2. check user is logged in and present confirmation screen (remote_follow_request) +3. On confirmation, 3. parse user into info needed for a normal follow +4. send follow request, on 200 response display success else display error (remote_follow) +5. Include button inviting to close window +""" From 2e428e6ea1687c15c87856f682a572cdff098e9c Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Sun, 28 Nov 2021 20:08:54 +1100 Subject: [PATCH 06/98] add remote follow templates --- bookwyrm/templates/ostatus/remote_follow.html | 43 +++++++++++++++++++ .../ostatus/remote_follow_button.html | 16 +++++++ 2 files changed, 59 insertions(+) create mode 100644 bookwyrm/templates/ostatus/remote_follow.html create mode 100644 bookwyrm/templates/ostatus/remote_follow_button.html diff --git a/bookwyrm/templates/ostatus/remote_follow.html b/bookwyrm/templates/ostatus/remote_follow.html new file mode 100644 index 000000000..ea8881e42 --- /dev/null +++ b/bookwyrm/templates/ostatus/remote_follow.html @@ -0,0 +1,43 @@ +{% extends 'ostatus/template.html' %} +{% load i18n %} +{% load utilities %} + +{% block content %} +
+
+

{% blocktrans %}Follow {{ user.display_name }} on the fediverse{% endblocktrans %}

+
+ +
+
+
+
+ {% csrf_token %} + + + +
+
+
+
+{% endblock %} diff --git a/bookwyrm/templates/ostatus/remote_follow_button.html b/bookwyrm/templates/ostatus/remote_follow_button.html new file mode 100644 index 000000000..4789d3064 --- /dev/null +++ b/bookwyrm/templates/ostatus/remote_follow_button.html @@ -0,0 +1,16 @@ +{% load i18n %} +{% if request.user == user %} +{% else %} + +
+
+
+ {% csrf_token %} + + +
+
+
+{% endif %} From 6e7d23c1aec60317e7989aaf5cafa08112d49cc0 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Sun, 28 Nov 2021 20:09:29 +1100 Subject: [PATCH 07/98] add remote follow button --- bookwyrm/templates/user/layout.html | 3 +++ bookwyrm/urls.py | 3 ++- bookwyrm/views/__init__.py | 2 +- bookwyrm/views/follow.py | 34 +++++++++++++++-------------- bookwyrm/views/helpers.py | 27 +++++++++++++++++++++++ 5 files changed, 51 insertions(+), 18 deletions(-) diff --git a/bookwyrm/templates/user/layout.html b/bookwyrm/templates/user/layout.html index d7557ae7b..03e3dfce8 100755 --- a/bookwyrm/templates/user/layout.html +++ b/bookwyrm/templates/user/layout.html @@ -39,6 +39,9 @@ {% if not is_self and request.user.is_authenticated %} {% include 'snippets/follow_button.html' with user=user %} {% endif %} + {% if not is_self %} + {% include 'ostatus/remote_follow_button.html' with user=user %} + {% endif %} {% if is_self and user.follower_requests.all %}
diff --git a/bookwyrm/templates/ostatus/template.html b/bookwyrm/templates/ostatus/template.html index 2e8ee7b3c..cb922f9bd 100644 --- a/bookwyrm/templates/ostatus/template.html +++ b/bookwyrm/templates/ostatus/template.html @@ -92,7 +92,6 @@ - diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index 48fe0f6cc..45837ec13 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -453,5 +453,7 @@ urlpatterns = [ re_path(r"^delete-follow-request/?$", views.delete_follow_request), re_path(r"^ostatus_follow/?$", views.remote_follow, name="remote-follow"), re_path(r"^remote_follow/?$", views.remote_follow_page, name="remote-follow-page"), - re_path(r"^ostatus_success/?$", views.ostatus_follow_success, name="ostatus-success"), + re_path( + r"^ostatus_success/?$", views.ostatus_follow_success, name="ostatus-success" + ), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/bookwyrm/views/__init__.py b/bookwyrm/views/__init__.py index 3b5bf8232..4a92578c2 100644 --- a/bookwyrm/views/__init__.py +++ b/bookwyrm/views/__init__.py @@ -58,7 +58,14 @@ from .author import Author, EditAuthor from .directory import Directory from .discover import Discover from .feed import DirectMessage, Feed, Replies, Status -from .follow import follow, unfollow, ostatus_follow_request, ostatus_follow_success, remote_follow, remote_follow_page +from .follow import ( + follow, + unfollow, + ostatus_follow_request, + ostatus_follow_success, + remote_follow, + remote_follow_page, +) from .follow import accept_follow_request, delete_follow_request from .get_started import GetStartedBooks, GetStartedProfile, GetStartedUsers from .goal import Goal, hide_goal diff --git a/bookwyrm/views/follow.py b/bookwyrm/views/follow.py index 2ebe0ce04..58d979854 100644 --- a/bookwyrm/views/follow.py +++ b/bookwyrm/views/follow.py @@ -8,7 +8,11 @@ from django.template.response import TemplateResponse from django.views.decorators.http import require_POST from bookwyrm import models -from .helpers import get_user_from_username, handle_remote_webfinger, subscribe_remote_webfinger +from .helpers import ( + get_user_from_username, + handle_remote_webfinger, + subscribe_remote_webfinger, +) @login_required @@ -32,7 +36,6 @@ def follow(request): return redirect(to_follow.local_path) - @login_required @require_POST def unfollow(request): @@ -92,12 +95,15 @@ def delete_follow_request(request): follow_request.delete() return redirect(f"/user/{request.user.localname}") + def ostatus_follow_request(request): """prepare an outgoing remote follow request""" # parse the acct URI into a user string uri = urllib.parse.unquote(request.GET.get("acct")) - username_parts = re.search("(?:^http(?:s?):\/\/)([\w\-\.]*)(?:.)*(?:(?:\/)([\w]*))", uri) + username_parts = re.search( + "(?:^http(?:s?):\/\/)([\w\-\.]*)(?:.)*(?:(?:\/)([\w]*))", uri + ) account = f"{username_parts[2]}@{username_parts[1]}" user = handle_remote_webfinger(account) error = None @@ -111,14 +117,13 @@ def ostatus_follow_request(request): if hasattr(user, "followers") and request.user in user.followers.all(): error = "already_following" - if hasattr(user, "follower_requests") and request.user in user.follower_requests.all(): + if ( + hasattr(user, "follower_requests") + and request.user in user.follower_requests.all() + ): error = "already_requested" - data = { - "account": account, - "user": user, - "error": error - } + data = {"account": account, "user": user, "error": error} return TemplateResponse(request, "ostatus/subscribe.html", data) @@ -127,21 +132,17 @@ def ostatus_follow_request(request): def ostatus_follow_success(request): """display success message for remote follow""" user = get_user_from_username(request.user, request.GET.get("following")) - data = { - "account": user.name, - "user": user, - "error": None - } + data = {"account": user.name, "user": user, "error": None} return TemplateResponse(request, "ostatus/success.html", data) + def remote_follow_page(request): """Display remote follow page""" user = get_user_from_username(request.user, request.GET.get("user")) - data = { - "user": user - } + data = {"user": user} return TemplateResponse(request, "ostatus/remote_follow.html", data) + @require_POST def remote_follow(request): """direct user to follow from remote account using ostatus subscribe protocol""" diff --git a/bookwyrm/views/helpers.py b/bookwyrm/views/helpers.py index 607181489..650087ec0 100644 --- a/bookwyrm/views/helpers.py +++ b/bookwyrm/views/helpers.py @@ -84,6 +84,7 @@ def handle_remote_webfinger(query): return None return user + def subscribe_remote_webfinger(query): """get subscribe template from other servers""" template = None @@ -112,6 +113,7 @@ def subscribe_remote_webfinger(query): return template + def get_edition(book_id): """look up a book in the db and return an edition""" book = models.Book.objects.select_subclasses().get(id=book_id) diff --git a/bookwyrm/views/wellknown.py b/bookwyrm/views/wellknown.py index c9b1c1299..03e619dfd 100644 --- a/bookwyrm/views/wellknown.py +++ b/bookwyrm/views/wellknown.py @@ -32,9 +32,9 @@ def webfinger(request): "href": user.remote_id, }, { - "rel": "http://ostatus.org/schema/1.0/subscribe", - "template": f"https://{DOMAIN}/ostatus_subscribe?acct={{uri}}" - } + "rel": "http://ostatus.org/schema/1.0/subscribe", + "template": f"https://{DOMAIN}/ostatus_subscribe?acct={{uri}}", + }, ], } ) From 6abf5d69107c4440e1809e34458e169e823d7e92 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Sun, 28 Nov 2021 21:48:03 +1100 Subject: [PATCH 10/98] add submit button to remote follow form --- bookwyrm/templates/ostatus/remote_follow.html | 1 + 1 file changed, 1 insertion(+) diff --git a/bookwyrm/templates/ostatus/remote_follow.html b/bookwyrm/templates/ostatus/remote_follow.html index ea8881e42..3ff769432 100644 --- a/bookwyrm/templates/ostatus/remote_follow.html +++ b/bookwyrm/templates/ostatus/remote_follow.html @@ -36,6 +36,7 @@ + From feaf0d5e52ec8d2887b2d14e3bcd3bfc49446cf4 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Mon, 29 Nov 2021 07:11:57 +1100 Subject: [PATCH 11/98] handle username errors in remote follow form --- bookwyrm/templates/ostatus/error.html | 5 +++++ bookwyrm/views/follow.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/bookwyrm/templates/ostatus/error.html b/bookwyrm/templates/ostatus/error.html index b6e858e24..cb1aec408 100644 --- a/bookwyrm/templates/ostatus/error.html +++ b/bookwyrm/templates/ostatus/error.html @@ -33,6 +33,11 @@

{% blocktrans %}Something went wrong trying to follow {{ account }}{% endblocktrans %}

{% trans 'Check you have the correct username before trying again.' %}

+ {% elif error == 'remote_subscribe' %} +
+

{% blocktrans %}Something went wrong trying to follow from {{ account }}{% endblocktrans %}

+

{% trans 'Check you have the correct username before trying again.' %}

+
{% elif error == 'is_blocked' %}

{% blocktrans %}You have blocked {{ account }}{% endblocktrans %}

diff --git a/bookwyrm/views/follow.py b/bookwyrm/views/follow.py index 58d979854..fcab5d6ac 100644 --- a/bookwyrm/views/follow.py +++ b/bookwyrm/views/follow.py @@ -148,5 +148,8 @@ def remote_follow(request): """direct user to follow from remote account using ostatus subscribe protocol""" remote_user = request.POST.get("remote_user") template = subscribe_remote_webfinger(remote_user) + if template is None: + data = {"account": remote_user, "user": None, "error": "remote_subscribe"} + return TemplateResponse(request, "ostatus/subscribe.html", data) url = template.replace("{uri}", request.POST.get("user")) return redirect(url) From 403e282d888da9ad02a1a5e6da88c190d9f48994 Mon Sep 17 00:00:00 2001 From: Joachim Date: Sun, 28 Nov 2021 21:52:28 +0100 Subject: [PATCH 12/98] Add `aria-describedby` to field help/error messages --- bookwyrm/forms.py | 43 +++++++++++++++++++ .../templates/preferences/delete_user.html | 4 +- bookwyrm/templates/preferences/edit_user.html | 22 ++++++---- bookwyrm/templates/settings/site.html | 8 ++-- 4 files changed, 62 insertions(+), 15 deletions(-) diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index 847ca05c0..aed5a7945 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 63bd2f860..a72cc97d7 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 72c49dbe5..a3f8962c8 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 94a4dd454..01b25036b 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 %}
From 46f32944315b9add4f04776668bbf7c2117efc12 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Mon, 29 Nov 2021 07:56:09 +1100 Subject: [PATCH 13/98] fix remote follow template --- bookwyrm/templates/ostatus/remote_follow.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/templates/ostatus/remote_follow.html b/bookwyrm/templates/ostatus/remote_follow.html index 3ff769432..98442547e 100644 --- a/bookwyrm/templates/ostatus/remote_follow.html +++ b/bookwyrm/templates/ostatus/remote_follow.html @@ -24,7 +24,7 @@ @{{ user|username }} -

Follow {{ user.name }} from another Fediverse account like Bookwyrm, Mastodon, or Pleroma.

+

Follow {{ user.display_name }} from another Fediverse account like Bookwyrm, Mastodon, or Pleroma.

From c7242b6022c9e70725e9445255fe766ecedee2ed Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Mon, 29 Nov 2021 07:56:31 +1100 Subject: [PATCH 14/98] add popup warning --- bookwyrm/templates/ostatus/remote_follow_button.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bookwyrm/templates/ostatus/remote_follow_button.html b/bookwyrm/templates/ostatus/remote_follow_button.html index 2848fde0e..fc869229a 100644 --- a/bookwyrm/templates/ostatus/remote_follow_button.html +++ b/bookwyrm/templates/ostatus/remote_follow_button.html @@ -4,9 +4,12 @@ {% endif %} From 85c688b1475bf79649f49619d8ab56a3200cd9b7 Mon Sep 17 00:00:00 2001 From: Joachim Date: Sun, 28 Nov 2021 22:01:49 +0100 Subject: [PATCH 15/98] Update forms.py --- bookwyrm/forms.py | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index aed5a7945..ffbb237b8 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -150,19 +150,13 @@ class EditUserForm(CustomForm): 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"} + 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"} + attrs={"aria-describedby": "desc_discoverable"} ), } @@ -180,16 +174,12 @@ class LimitedEditUserForm(CustomForm): 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"} + 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"} + attrs={"aria-describedby": "desc_discoverable"} ), } @@ -322,13 +312,13 @@ class SiteForm(CustomForm): exclude = [] widgets = { "instance_short_description": forms.TextInput( - attrs={'aria-describedby': "desc_instance_short_description"} + attrs={"aria-describedby": "desc_instance_short_description"} ), "require_confirm_email": forms.CheckboxInput( - attrs={'aria-describedby': "desc_require_confirm_email"} + attrs={"aria-describedby": "desc_require_confirm_email"} ), "invite_request_text": forms.Textarea( - attrs={'aria-describedby': "desc_invite_request_text"} + attrs={"aria-describedby": "desc_invite_request_text"} ), } From 4a9713b812d65d2bc2f9ef4ecbc1eeec8f6a617f Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Mon, 29 Nov 2021 08:03:01 +1100 Subject: [PATCH 16/98] fix template for remote follower error --- bookwyrm/templates/ostatus/error.html | 2 +- bookwyrm/templates/ostatus/subscribe.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bookwyrm/templates/ostatus/error.html b/bookwyrm/templates/ostatus/error.html index cb1aec408..442c35b9e 100644 --- a/bookwyrm/templates/ostatus/error.html +++ b/bookwyrm/templates/ostatus/error.html @@ -2,7 +2,7 @@ {% block content %}
- {% if not request.user.is_authenticated %} + {% if not request.user.is_authenticated and not error == 'remote_subscribe' %}
diff --git a/bookwyrm/templates/ostatus/success.html b/bookwyrm/templates/ostatus/success.html index 10b4409f3..d8c311829 100644 --- a/bookwyrm/templates/ostatus/success.html +++ b/bookwyrm/templates/ostatus/success.html @@ -22,11 +22,14 @@ @{{ user|username }} - - - {% include 'snippets/avatar.html' with user=user large=True %} - +

+ + {% trans 'You are now following ' %}{{ user.display_name }}! +

+ {% endblock %} From 3d73ea92e85b84bfc4f7e2fc5a8fab5179767e00 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Mon, 29 Nov 2021 18:08:25 +1100 Subject: [PATCH 19/98] handle user blocks properly --- bookwyrm/templates/ostatus/error.html | 4 +++ bookwyrm/views/follow.py | 36 +++++++++++++++++++-------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/bookwyrm/templates/ostatus/error.html b/bookwyrm/templates/ostatus/error.html index 91bb6a0a4..8a047172f 100644 --- a/bookwyrm/templates/ostatus/error.html +++ b/bookwyrm/templates/ostatus/error.html @@ -42,6 +42,10 @@

{% blocktrans %}You have blocked {{ account }}{% endblocktrans %}

+ {% elif error == 'has_blocked' %} +
+

{% blocktrans %}{{ account }} has blocked you{% endblocktrans %}

+
{% elif error == 'already_following' %}

{% blocktrans %}You are already following {{ account }}{% endblocktrans %}

diff --git a/bookwyrm/views/follow.py b/bookwyrm/views/follow.py index 1555fc5e4..83b900354 100644 --- a/bookwyrm/views/follow.py +++ b/bookwyrm/views/follow.py @@ -109,17 +109,33 @@ def ostatus_follow_request(request): if user is None or user == "": error = "ostatus_subscribe" - if hasattr(request.user, "blocks") and user in request.user.blocks.all(): - error = "is_blocked" + # don't do these checks for AnonymousUser before they sign in + if request.user.id: - if hasattr(user, "followers") and request.user in user.followers.all(): - error = "already_following" - - if ( - hasattr(user, "follower_requests") - and request.user in user.follower_requests.all() - ): - error = "already_requested" + # you have blocked them so you probably don't want to follow + if ( + hasattr(request.user, "blocks") + and user in request.user.blocks.all() + ): + error = "is_blocked" + # they have blocked you + if ( + hasattr(user, "blocks") + and request.user in user.blocks.all() + ): + error = "has_blocked" + # you're already following them + if ( + hasattr(user, "followers") + and request.user in user.followers.all() + ): + error = "already_following" + # you're not following yet but you already asked + if ( + hasattr(user, "follower_requests") + and request.user in user.follower_requests.all() + ): + error = "already_requested" data = {"account": account, "user": user, "error": error} From f5d9a204ebfd0045a04046200feaeaa3b21d68d8 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Mon, 29 Nov 2021 19:37:56 +1100 Subject: [PATCH 20/98] clean up ostatus templates --- bookwyrm/templates/ostatus/error.html | 46 +++--- bookwyrm/templates/ostatus/remote_follow.html | 67 +++++---- bookwyrm/templates/ostatus/success.html | 46 +++--- bookwyrm/templates/ostatus/template.html | 133 +++++++++--------- 4 files changed, 145 insertions(+), 147 deletions(-) diff --git a/bookwyrm/templates/ostatus/error.html b/bookwyrm/templates/ostatus/error.html index 8a047172f..085fa3454 100644 --- a/bookwyrm/templates/ostatus/error.html +++ b/bookwyrm/templates/ostatus/error.html @@ -4,30 +4,28 @@
{% if not request.user.is_authenticated and not error == 'remote_subscribe' %} +
+
+
+ {% csrf_token %} +
+
+ + +
+
+ + +

{% trans "Forgot your password?" %}

+
+
+ +
+
+
+
+
+
{% elif error == 'ostatus_subscribe' %}

{% blocktrans %}Something went wrong trying to follow {{ account }}{% endblocktrans %}

diff --git a/bookwyrm/templates/ostatus/remote_follow.html b/bookwyrm/templates/ostatus/remote_follow.html index ef8f1b90f..6a4e565ac 100644 --- a/bookwyrm/templates/ostatus/remote_follow.html +++ b/bookwyrm/templates/ostatus/remote_follow.html @@ -4,41 +4,40 @@ {% block content %}
-
-

{% blocktrans %}Follow {{ user.display_name }} on the fediverse{% endblocktrans %}

-
-
-
- - {% include 'snippets/avatar.html' with user=user large=True %} - -
- - - {{ user.display_name }} - {% if user.manually_approves_followers %} - - {% trans "Locked account" %} - - {% endif %} - - @{{ user|username }} - -

{% blocktrans %}Follow {{ user.display_name }} from another Fediverse account like Bookwyrm, Mastodon, or Pleroma.{% endblocktrans %}

-
-
+
+

{% blocktrans %}Follow {{ user.display_name }} on the fediverse{% endblocktrans %}

+
+
+
+ + {% include 'snippets/avatar.html' with user=user large=True %} + +
+ + + {{ user.display_name }} + {% if user.manually_approves_followers %} + + {% trans "Locked account" %} + + {% endif %} + + @{{ user|username }} + +

{% blocktrans %}Follow {{ user.display_name }} from another Fediverse account like Bookwyrm, Mastodon, or Pleroma.{% endblocktrans %}

+
+
-
-
-
- {% csrf_token %} - - - - -
-
-
+
+
+
+ {% csrf_token %} + + + + +
+
{% endblock %} diff --git a/bookwyrm/templates/ostatus/success.html b/bookwyrm/templates/ostatus/success.html index d8c311829..89f662735 100644 --- a/bookwyrm/templates/ostatus/success.html +++ b/bookwyrm/templates/ostatus/success.html @@ -4,29 +4,29 @@ {% block content %}
-
diff --git a/bookwyrm/templates/ostatus/template.html b/bookwyrm/templates/ostatus/template.html index cb922f9bd..1dbb32a36 100644 --- a/bookwyrm/templates/ostatus/template.html +++ b/bookwyrm/templates/ostatus/template.html @@ -7,45 +7,46 @@ - {% block title %}{% endblock %}{{ site.name }} - - - - + {% block title %}{% endblock %}{{ site.name }} + + + + - + - + - {% if preview_images_enabled is True %} - - {% else %} - - {% endif %} - - - - + {% if preview_images_enabled is True %} + + {% else %} + + {% endif %} + + + + - {% block opengraph_images %} - {% include 'snippets/opengraph_images.html' %} - {% endblock %} - - + {% block opengraph_images %} + {% include 'snippets/opengraph_images.html' %} + {% endblock %} + + @@ -57,43 +58,43 @@ From 9a3ec4362b85ce7920632ff6a74ee44f4b99d9ff Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Mon, 29 Nov 2021 19:45:52 +1100 Subject: [PATCH 21/98] code cleanup --- bookwyrm/static/js/bookwyrm.js | 13 ++++++------- bookwyrm/views/follow.py | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/bookwyrm/static/js/bookwyrm.js b/bookwyrm/static/js/bookwyrm.js index 86a021af8..ebac78a91 100644 --- a/bookwyrm/static/js/bookwyrm.js +++ b/bookwyrm/static/js/bookwyrm.js @@ -376,12 +376,11 @@ let BookWyrm = new class { * @param {string} windowName windowName * @return {undefined} */ - displayPopUp(url, windowName){ - - window.open( - url, - windowName, - "left=100,top=100,width=430,height=600" - ) + displayPopUp(url, windowName) { + window.open( + url, + windowName, + "left=100,top=100,width=430,height=600" + ); } }(); diff --git a/bookwyrm/views/follow.py b/bookwyrm/views/follow.py index 83b900354..11bff60a3 100644 --- a/bookwyrm/views/follow.py +++ b/bookwyrm/views/follow.py @@ -100,7 +100,7 @@ def ostatus_follow_request(request): """prepare an outgoing remote follow request""" uri = urllib.parse.unquote(request.GET.get("acct")) username_parts = re.search( - "(?:^http(?:s?):\/\/)([\w\-\.]*)(?:.)*(?:(?:\/)([\w]*))", uri + r"(?:^http(?:s?):\/\/)([\w\-\.]*)(?:.)*(?:(?:\/)([\w]*))", uri ) account = f"{username_parts[2]}@{username_parts[1]}" user = handle_remote_webfinger(account) From 1211fda7ff82a2eca793981cb5fbddda4643af5b Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Mon, 29 Nov 2021 19:53:13 +1100 Subject: [PATCH 22/98] beautiful code quality, pylint will be pleased --- bookwyrm/templates/ostatus/template.html | 2 +- bookwyrm/views/follow.py | 19 ++++--------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/bookwyrm/templates/ostatus/template.html b/bookwyrm/templates/ostatus/template.html index 1dbb32a36..7d670b0a5 100644 --- a/bookwyrm/templates/ostatus/template.html +++ b/bookwyrm/templates/ostatus/template.html @@ -33,7 +33,7 @@ diff --git a/bookwyrm/views/follow.py b/bookwyrm/views/follow.py index 11bff60a3..7af8b0db7 100644 --- a/bookwyrm/views/follow.py +++ b/bookwyrm/views/follow.py @@ -113,22 +113,13 @@ def ostatus_follow_request(request): if request.user.id: # you have blocked them so you probably don't want to follow - if ( - hasattr(request.user, "blocks") - and user in request.user.blocks.all() - ): + if hasattr(request.user, "blocks") and user in request.user.blocks.all(): error = "is_blocked" # they have blocked you - if ( - hasattr(user, "blocks") - and request.user in user.blocks.all() - ): + if hasattr(user, "blocks") and request.user in user.blocks.all(): error = "has_blocked" # you're already following them - if ( - hasattr(user, "followers") - and request.user in user.followers.all() - ): + if hasattr(user, "followers") and request.user in user.followers.all(): error = "already_following" # you're not following yet but you already asked if ( @@ -165,8 +156,6 @@ def remote_follow(request): if template is None: data = {"account": remote_user, "user": None, "error": "remote_subscribe"} return TemplateResponse(request, "ostatus/subscribe.html", data) - user = get_object_or_404( - models.User, id=request.POST.get("user") - ) + user = get_object_or_404(models.User, id=request.POST.get("user")) url = template.replace("{uri}", urllib.parse.quote(user.remote_id)) return redirect(url) From 1d90ca6fa62362e840ca2ba9fd0306b0ea8a2752 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Mon, 29 Nov 2021 20:35:26 +1100 Subject: [PATCH 23/98] keep footer DRY Pulls footer and scripts after it into a separate component template. This allows ostatus/template to use the footer without having to use layout without repeating the same code. --- bookwyrm/templates/components/footer.html | 49 +++++++++++++++++++++++ bookwyrm/templates/layout.html | 45 +-------------------- bookwyrm/templates/ostatus/template.html | 48 +--------------------- 3 files changed, 51 insertions(+), 91 deletions(-) create mode 100644 bookwyrm/templates/components/footer.html diff --git a/bookwyrm/templates/components/footer.html b/bookwyrm/templates/components/footer.html new file mode 100644 index 000000000..047d7bfad --- /dev/null +++ b/bookwyrm/templates/components/footer.html @@ -0,0 +1,49 @@ +{% load layout %} +{% load i18n %} +{% load static %} + + + + + + + + + +{% block scripts %}{% endblock %} diff --git a/bookwyrm/templates/layout.html b/bookwyrm/templates/layout.html index f2d04f961..50a7ae6d1 100644 --- a/bookwyrm/templates/layout.html +++ b/bookwyrm/templates/layout.html @@ -222,50 +222,7 @@
- +{% include 'components/footer.html' %} - - - - - - -{% block scripts %}{% endblock %} diff --git a/bookwyrm/templates/ostatus/template.html b/bookwyrm/templates/ostatus/template.html index 7d670b0a5..04e432aaa 100644 --- a/bookwyrm/templates/ostatus/template.html +++ b/bookwyrm/templates/ostatus/template.html @@ -48,59 +48,13 @@
- -
{% block content%}{% endblock %}
- - +{% include 'components/footer.html' %} - - - - - - -{% block scripts %}{% endblock %} From 1636dfd308ca8eb8827a6aa8f6be9587bc902656 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Mon, 29 Nov 2021 20:42:16 +1100 Subject: [PATCH 24/98] fix footer indentation --- bookwyrm/templates/components/footer.html | 68 +++++++++++------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/bookwyrm/templates/components/footer.html b/bookwyrm/templates/components/footer.html index 047d7bfad..df11e9d55 100644 --- a/bookwyrm/templates/components/footer.html +++ b/bookwyrm/templates/components/footer.html @@ -3,43 +3,43 @@ {% load static %} From dd0114c64468b84323aa7cc7526baee683ca07b5 Mon Sep 17 00:00:00 2001 From: Joachim Date: Mon, 29 Nov 2021 22:33:03 +0100 Subject: [PATCH 25/98] Include errors display snippet --- .../templates/preferences/delete_user.html | 5 ++--- bookwyrm/templates/preferences/edit_user.html | 20 ++++++++----------- bookwyrm/templates/settings/site.html | 5 ++--- bookwyrm/templates/snippets/form_errors.html | 9 +++++++++ 4 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 bookwyrm/templates/snippets/form_errors.html diff --git a/bookwyrm/templates/preferences/delete_user.html b/bookwyrm/templates/preferences/delete_user.html index a72cc97d7..b009230c5 100644 --- a/bookwyrm/templates/preferences/delete_user.html +++ b/bookwyrm/templates/preferences/delete_user.html @@ -19,9 +19,8 @@
- {% 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 a3f8962c8..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" %}
diff --git a/bookwyrm/templates/settings/site.html b/bookwyrm/templates/settings/site.html index 01b25036b..3c05e1473 100644 --- a/bookwyrm/templates/settings/site.html +++ b/bookwyrm/templates/settings/site.html @@ -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/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 %} From 28f0882ba61dec1f41748d7e0ea9477ae1f71168 Mon Sep 17 00:00:00 2001 From: Joachim Date: Mon, 29 Nov 2021 22:39:01 +0100 Subject: [PATCH 26/98] Handle Author form errors --- bookwyrm/forms.py | 34 ++++++++++++++- bookwyrm/templates/author/edit_author.html | 50 +++++++++------------- 2 files changed, 53 insertions(+), 31 deletions(-) diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index ffbb237b8..88820c8f1 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -236,7 +236,39 @@ 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): csv_file = forms.FileField() 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" %}
From adb0d356a8d81ed63c64e74befa9a4ac9dcfea76 Mon Sep 17 00:00:00 2001 From: Joachim Date: Mon, 29 Nov 2021 22:39:44 +0100 Subject: [PATCH 27/98] Update site.html --- bookwyrm/templates/settings/site.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/templates/settings/site.html b/bookwyrm/templates/settings/site.html index 3c05e1473..8efad308d 100644 --- a/bookwyrm/templates/settings/site.html +++ b/bookwyrm/templates/settings/site.html @@ -124,7 +124,7 @@ {{ site_form.invite_request_text }} - {% include 'snippets/form_errors.html' with errors_list=site_form.invite_request_text.errors id="desc_invite_request_text" %} + {% include 'snippets/form_errors.html' with errors_list=site_form.invite_request_text.errors id="desc_invite_request_text" %} From c2873c601f4deb2efa05af166fe49c9a373479af Mon Sep 17 00:00:00 2001 From: Joachim Date: Mon, 29 Nov 2021 23:26:25 +0100 Subject: [PATCH 28/98] Register form --- .../templates/snippets/register_form.html | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) 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" %}
- +
From 08b4c538e621f0ba979f94aeefa89064a304d5e7 Mon Sep 17 00:00:00 2001 From: Joachim Date: Mon, 29 Nov 2021 23:26:43 +0100 Subject: [PATCH 29/98] User moderation actions --- .../users/user_moderation_actions.html | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) 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 %} From a154597de179d76f491499a06c72db430db198f1 Mon Sep 17 00:00:00 2001 From: Joachim Date: Mon, 29 Nov 2021 23:26:53 +0100 Subject: [PATCH 30/98] Delete user form --- bookwyrm/templates/settings/users/delete_user_form.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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" %}
From 0a621550b8863d7dda304864f09a12b4e0248baf Mon Sep 17 00:00:00 2001 From: Joachim Date: Mon, 29 Nov 2021 23:27:04 +0100 Subject: [PATCH 31/98] IP address form --- .../settings/ip_blocklist/ip_address_form.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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" %}
- +
From 5d0c6bdde24d9964848826bdf12f5683145655d6 Mon Sep 17 00:00:00 2001 From: Joachim Date: Mon, 29 Nov 2021 23:27:25 +0100 Subject: [PATCH 32/98] Edit instance form --- .../settings/federation/edit_instance.html | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) 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 %} From a6760cabc86d99b23bda32e36464a4a913aa7c3c Mon Sep 17 00:00:00 2001 From: Joachim Date: Mon, 29 Nov 2021 23:28:29 +0100 Subject: [PATCH 33/98] Email domain form --- bookwyrm/forms.py | 5 +++++ bookwyrm/templates/settings/email_blocklist/domain_form.html | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index 88820c8f1..ddb02d937 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -383,6 +383,11 @@ 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/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" %}
From 659d13d0a60e80ac17e28ba2c41a295fb2b73422 Mon Sep 17 00:00:00 2001 From: Joachim Date: Mon, 29 Nov 2021 23:28:51 +0100 Subject: [PATCH 34/98] Announcement form --- bookwyrm/forms.py | 20 +++++++ .../announcements/announcement_form.html | 58 +++++++++++-------- 2 files changed, 53 insertions(+), 25 deletions(-) diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index ddb02d937..e8136a54f 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -359,6 +359,26 @@ 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): 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 %} From 63d31b8623d5eb084b049b5acbf8ae0a91da8408 Mon Sep 17 00:00:00 2001 From: Joachim Date: Mon, 29 Nov 2021 23:29:22 +0100 Subject: [PATCH 35/98] Edit book form --- bookwyrm/forms.py | 61 ++++- .../templates/book/edit/edit_book_form.html | 229 ++++++++++-------- 2 files changed, 194 insertions(+), 96 deletions(-) diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index e8136a54f..3f46be348 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -218,6 +218,65 @@ 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): @@ -268,7 +327,7 @@ class AuthorForm(CustomForm): attrs={"aria-describedby": "desc_goodreads_key"} ), } - + class ImportForm(forms.Form): csv_file = forms.FileField() diff --git a/bookwyrm/templates/book/edit/edit_book_form.html b/bookwyrm/templates/book/edit/edit_book_form.html index 982bb56d2..feebb803c 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,9 +138,13 @@
{% endif %}
- - - {% trans "Separate multiple values with commas." %} + + + + {% trans "Separate multiple values with commas." %} +
@@ -129,7 +152,9 @@
-

{% trans "Cover" %}

+

+ {% trans "Cover" %} +

{% if book.cover %} @@ -140,108 +165,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" %}
From 3eb4dfdc9be1cb4bc8b7e7ce718a030fa9ce4985 Mon Sep 17 00:00:00 2001 From: Joachim Date: Mon, 29 Nov 2021 23:29:36 +0100 Subject: [PATCH 36/98] Get started user form --- bookwyrm/templates/get_started/profile.html | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) 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" %}
From 3cf9660df30f4eec6f4779029ce33cbf3752bf0f Mon Sep 17 00:00:00 2001 From: Joachim Date: Mon, 29 Nov 2021 23:29:56 +0100 Subject: [PATCH 37/98] Login form --- bookwyrm/templates/landing/layout.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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" %}
From 80535a3b0caee396b82ca39207a4d03e251c9174 Mon Sep 17 00:00:00 2001 From: Joachim Date: Mon, 29 Nov 2021 23:30:14 +0100 Subject: [PATCH 38/98] Login form --- bookwyrm/templates/landing/login.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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" %}
From 43072a357f2f100907dafc608f9319444dc16f48 Mon Sep 17 00:00:00 2001 From: Joachim Date: Mon, 29 Nov 2021 23:30:23 +0100 Subject: [PATCH 39/98] Password reset form --- .../templates/landing/password_reset.html | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) 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 %}
- +
- +
- +
- +
From 4d93545d885400cc6370e2410b5311d1502e2dd5 Mon Sep 17 00:00:00 2001 From: Joachim Date: Mon, 29 Nov 2021 23:31:05 +0100 Subject: [PATCH 40/98] Lint forms --- bookwyrm/forms.py | 64 ++++++++++++----------------------------------- 1 file changed, 16 insertions(+), 48 deletions(-) diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index 3f46be348..aff1e29cb 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -219,18 +219,12 @@ class EditionForm(CustomForm): "search_vector", ] widgets = { - "title": forms.TextInput( - attrs={"aria-describedby": "desc_title"} - ), - "subtitle": forms.TextInput( - attrs={"aria-describedby": "desc_subtitle"} - ), + "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": forms.TextInput(attrs={"aria-describedby": "desc_series"}), "series_number": forms.TextInput( attrs={"aria-describedby": "desc_series_number"} ), @@ -255,15 +249,9 @@ class EditionForm(CustomForm): "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"} - ), + "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"} ), @@ -273,9 +261,7 @@ class EditionForm(CustomForm): "oclc_number": forms.TextInput( attrs={"aria-describedby": "desc_oclc_number"} ), - "ASIN": forms.TextInput( - attrs={"aria-describedby": "desc_ASIN"} - ), + "ASIN": forms.TextInput(attrs={"aria-describedby": "desc_ASIN"}), } @@ -296,24 +282,14 @@ class AuthorForm(CustomForm): "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"} - ), + "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"} - ), + "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"} ), @@ -419,12 +395,8 @@ class AnnouncementForm(CustomForm): model = models.Announcement exclude = ["remote_id"] widgets = { - "preview": forms.TextInput( - attrs={"aria-describedby": "desc_preview"} - ), - "content": forms.Textarea( - attrs={"aria-describedby": "desc_content"} - ), + "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"} ), @@ -434,9 +406,7 @@ class AnnouncementForm(CustomForm): "end_date": forms.SelectDateWidget( attrs={"aria-describedby": "desc_end_date"} ), - "active": forms.CheckboxInput( - attrs={"aria-describedby": "desc_active"} - ), + "active": forms.CheckboxInput(attrs={"aria-describedby": "desc_active"}), } @@ -463,9 +433,7 @@ class EmailBlocklistForm(CustomForm): model = models.EmailBlocklist fields = ["domain"] widgets = { - "avatar": forms.TextInput( - attrs={'aria-describedby': "desc_domain"} - ), + "avatar": forms.TextInput(attrs={"aria-describedby": "desc_domain"}), } From 386371baa3ee85e54c1f918c41297dc3c0681120 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Tue, 30 Nov 2021 12:42:52 +1100 Subject: [PATCH 41/98] improve a11y on notifications Also change close link to a button. Co-authored-by: Joachim --- bookwyrm/templates/ostatus/error.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bookwyrm/templates/ostatus/error.html b/bookwyrm/templates/ostatus/error.html index 085fa3454..99a2a9acb 100644 --- a/bookwyrm/templates/ostatus/error.html +++ b/bookwyrm/templates/ostatus/error.html @@ -27,34 +27,34 @@
{% elif error == 'ostatus_subscribe' %} -
+

{% blocktrans %}Something went wrong trying to follow {{ account }}{% endblocktrans %}

{% trans 'Check you have the correct username before trying again.' %}

{% elif error == 'remote_subscribe' %} -
+

{% blocktrans %}Something went wrong trying to follow from {{ account }}{% endblocktrans %}

{% trans 'Check you have the correct username before trying again.' %}

{% elif error == 'is_blocked' %} -
+

{% blocktrans %}You have blocked {{ account }}{% endblocktrans %}

{% elif error == 'has_blocked' %} -
+

{% blocktrans %}{{ account }} has blocked you{% endblocktrans %}

{% elif error == 'already_following' %} -
+

{% blocktrans %}You are already following {{ account }}{% endblocktrans %}

{% elif error == 'already_requested' %} -
+

{% blocktrans %}You have already requested to follow {{ account }}{% endblocktrans %}

{% endif %}
- Close window +
{% endblock %} From 4ee234258a15edb56485306480cb141f291e6c1b Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Tue, 30 Nov 2021 12:47:04 +1100 Subject: [PATCH 42/98] remove OG meta in ostatus template It's just a temporary popup so would be weird to share and just gunks things up. Co-authored-by: Joachim --- bookwyrm/templates/ostatus/template.html | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/bookwyrm/templates/ostatus/template.html b/bookwyrm/templates/ostatus/template.html index 04e432aaa..68284a35f 100644 --- a/bookwyrm/templates/ostatus/template.html +++ b/bookwyrm/templates/ostatus/template.html @@ -17,20 +17,6 @@ - {% if preview_images_enabled is True %} - - {% else %} - - {% endif %} - - - - - - {% block opengraph_images %} - {% include 'snippets/opengraph_images.html' %} - {% endblock %} - - - - - - -{% block scripts %}{% endblock %} diff --git a/bookwyrm/templates/layout.html b/bookwyrm/templates/layout.html index 50a7ae6d1..bc85e678e 100644 --- a/bookwyrm/templates/layout.html +++ b/bookwyrm/templates/layout.html @@ -222,7 +222,51 @@
-{% include 'components/footer.html' %} + + + + + + + + +{% block scripts %}{% endblock %} From 7848ff792766b67d171e27dcab13f485cbf23bd4 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Tue, 30 Nov 2021 20:46:41 +1100 Subject: [PATCH 44/98] fix translation strings --- bookwyrm/templates/ostatus/remote_follow.html | 11 +++++++---- bookwyrm/templates/ostatus/subscribe.html | 10 +++++----- bookwyrm/templates/ostatus/success.html | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/bookwyrm/templates/ostatus/remote_follow.html b/bookwyrm/templates/ostatus/remote_follow.html index 6a4e565ac..96c7f9452 100644 --- a/bookwyrm/templates/ostatus/remote_follow.html +++ b/bookwyrm/templates/ostatus/remote_follow.html @@ -2,11 +2,12 @@ {% load i18n %} {% load utilities %} +{% block heading %} +{% blocktrans with username=user.localname sitename=site.name %}Follow {{ username }} on the fediverse{% endblocktrans %} +{% endblock %} + {% block content %}
-
-

{% blocktrans %}Follow {{ user.display_name }} on the fediverse{% endblocktrans %}

-
@@ -24,11 +25,13 @@ @{{ user|username }} -

{% blocktrans %}Follow {{ user.display_name }} from another Fediverse account like Bookwyrm, Mastodon, or Pleroma.{% endblocktrans %}

+
+

{% blocktrans with username=user.display_name %}Follow {{ username }} from another Fediverse account like Bookwyrm, Mastodon, or Pleroma.{% endblocktrans %}

+
diff --git a/bookwyrm/templates/ostatus/subscribe.html b/bookwyrm/templates/ostatus/subscribe.html index d41ce6743..51dec4382 100644 --- a/bookwyrm/templates/ostatus/subscribe.html +++ b/bookwyrm/templates/ostatus/subscribe.html @@ -5,11 +5,11 @@ {% block title %} {% if not request.user.is_authenticated %} -{% trans "Log in to " %} +{% blocktrans with sitename=site.name %}Log in to {{ sitename }}{% endblocktrans %} {% elif error %} -{% trans "Error following from " %} +{% blocktrans with sitename=site.name %}Error following from {{ sitename }}{% endblocktrans %} {% else %} -{% trans "Follow from " %} +{% blocktrans with sitename=site.name %}Follow from {{ sitename }}{% endblocktrans %} {% endif %} {% endblock %} @@ -19,7 +19,7 @@ {% elif error %} {% trans 'Uh oh...' %} {% else %} -{% trans 'Follow from ' %}{{ site.name }} +{% blocktrans with sitename=site.name %}Follow from {{ sitename }}{% endblocktrans %} {% endif %} {% endblock %} @@ -48,7 +48,7 @@ {% csrf_token %} - +
diff --git a/bookwyrm/templates/ostatus/success.html b/bookwyrm/templates/ostatus/success.html index 89f662735..a652989be 100644 --- a/bookwyrm/templates/ostatus/success.html +++ b/bookwyrm/templates/ostatus/success.html @@ -25,7 +25,7 @@

- {% trans 'You are now following ' %}{{ user.display_name }}! + {% blocktrans with display_name=user.display_name %}You are now following {{ display_name }}!{% endblocktrans %}

From 080fa72c84b6608d0788e2fc1b31cf0e34ed2b1c Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Tue, 30 Nov 2021 21:01:07 +1100 Subject: [PATCH 45/98] ostatus template fixes - remove unnecessary links - remove footer - remove unnecessary JS scripts - make block title and block heading empty --- bookwyrm/templates/ostatus/template.html | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/bookwyrm/templates/ostatus/template.html b/bookwyrm/templates/ostatus/template.html index 68284a35f..8d2d193ec 100644 --- a/bookwyrm/templates/ostatus/template.html +++ b/bookwyrm/templates/ostatus/template.html @@ -7,16 +7,11 @@ - {% block title %}{% endblock %}{{ site.name }} + {% block title %}{% endblock %} - - - - - + From 461c35f416e1838c470824d03f10c8eed8a7ff73 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Tue, 30 Nov 2021 21:02:39 +1100 Subject: [PATCH 46/98] fix buttons --- bookwyrm/templates/ostatus/error.html | 2 +- bookwyrm/templates/ostatus/success.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bookwyrm/templates/ostatus/error.html b/bookwyrm/templates/ostatus/error.html index 99a2a9acb..0c8d6f768 100644 --- a/bookwyrm/templates/ostatus/error.html +++ b/bookwyrm/templates/ostatus/error.html @@ -55,6 +55,6 @@ {% endif %}
- +
{% endblock %} diff --git a/bookwyrm/templates/ostatus/success.html b/bookwyrm/templates/ostatus/success.html index a652989be..a4f78ace8 100644 --- a/bookwyrm/templates/ostatus/success.html +++ b/bookwyrm/templates/ostatus/success.html @@ -30,6 +30,6 @@
- Close window +
{% endblock %} From 9be1a8f4557e98e9bfe4aee072f074fed3fc4d5a Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Wed, 1 Dec 2021 07:45:30 +1100 Subject: [PATCH 47/98] keep close button simple --- bookwyrm/templates/ostatus/error.html | 2 +- bookwyrm/templates/ostatus/success.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bookwyrm/templates/ostatus/error.html b/bookwyrm/templates/ostatus/error.html index 0c8d6f768..b5a3bf406 100644 --- a/bookwyrm/templates/ostatus/error.html +++ b/bookwyrm/templates/ostatus/error.html @@ -55,6 +55,6 @@ {% endif %}
- +
{% endblock %} diff --git a/bookwyrm/templates/ostatus/success.html b/bookwyrm/templates/ostatus/success.html index a4f78ace8..66577e83f 100644 --- a/bookwyrm/templates/ostatus/success.html +++ b/bookwyrm/templates/ostatus/success.html @@ -30,6 +30,6 @@
- +
{% endblock %} From 5f10ccd9c7cb0f953b197bc5239515c5d33b0fa0 Mon Sep 17 00:00:00 2001 From: Olof Pettersson Date: Wed, 1 Dec 2021 14:18:28 +0100 Subject: [PATCH 48/98] Comment out trailing block ending For people installing an instance with only the reverse proxy server, the hidden trailing `}` at the end of the second server block is quite hard to catch and it took me a good while to figure it out. Having the entire server commented out makes the whole process more understandable in my opinion. --- nginx/production | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nginx/production b/nginx/production index 8a13413a6..3d9cfa5ae 100644 --- a/nginx/production +++ b/nginx/production @@ -17,7 +17,8 @@ server { # # redirect http to https # return 301 https://your-domain.com$request_uri; -# } +} + # # server { # listen [::]:443 ssl http2; @@ -54,7 +55,7 @@ server { # location /static/ { # alias /app/static/; # } -} +# } # Reverse-Proxy server # server { From 14ba04d393b2b8d9f12f4cb8028ea2de6484c18b Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 4 Dec 2021 08:28:47 -0800 Subject: [PATCH 49/98] Add local copy of nginx conf to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 624ce100c..e5582694a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.swp **/__pycache__ .local +/nginx/nginx.conf # VSCode /.vscode From ba04c3382b892806286fdd1388108d44844ffa45 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 4 Dec 2021 09:12:04 -0800 Subject: [PATCH 50/98] Adds autocomplete file for bw-dev --- complete_bwdev.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 complete_bwdev.sh diff --git a/complete_bwdev.sh b/complete_bwdev.sh new file mode 100644 index 000000000..b410df5ea --- /dev/null +++ b/complete_bwdev.sh @@ -0,0 +1,5 @@ +#/usr/bin/env bash +# for zsh, run: +# autoload bashcompinit +# bashcompinit +complete -W "up service_ports_web initdb resetdb makemigrations migrate bash shell dbshell restart_celery pytest collectstatic makemessages compilemessages update_locales build clean black populate_streams populate_suggestions generate_thumbnails generate_preview_images copy_media_to_s3 set_cors_to_s3 runweb" -o bashdefault -o default bw-dev From 4e47c19901c59f80e17d232118a69f74ba7cc482 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 4 Dec 2021 09:15:23 -0800 Subject: [PATCH 51/98] Adds line breaks --- complete_bwdev.sh | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/complete_bwdev.sh b/complete_bwdev.sh index b410df5ea..b9cd7420b 100644 --- a/complete_bwdev.sh +++ b/complete_bwdev.sh @@ -2,4 +2,28 @@ # for zsh, run: # autoload bashcompinit # bashcompinit -complete -W "up service_ports_web initdb resetdb makemigrations migrate bash shell dbshell restart_celery pytest collectstatic makemessages compilemessages update_locales build clean black populate_streams populate_suggestions generate_thumbnails generate_preview_images copy_media_to_s3 set_cors_to_s3 runweb" -o bashdefault -o default bw-dev +complete -W "up +service_ports_web +initdb +resetdb +makemigrations +migrate +bash +shell +dbshell +restart_celery +pytest +collectstatic +makemessages +compilemessages +update_locales +build +clean +black +populate_streams +populate_suggestions +generate_thumbnails +generate_preview_images +copy_media_to_s3 +set_cors_to_s3 +runweb" -o bashdefault -o default bw-dev From 5b27952b34fa47652a6cf51e2272d8ee18b5c151 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 4 Dec 2021 09:48:55 -0800 Subject: [PATCH 52/98] Use html details instead of javascript menus --- bookwyrm/static/css/bookwyrm.css | 4 ++++ bookwyrm/templates/components/dropdown.html | 17 ++++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/bookwyrm/static/css/bookwyrm.css b/bookwyrm/static/css/bookwyrm.css index 0d280fd53..3d9db3011 100644 --- a/bookwyrm/static/css/bookwyrm.css +++ b/bookwyrm/static/css/bookwyrm.css @@ -115,6 +115,10 @@ input[type=file]::file-selector-button:hover { color: #363636; } +details[open] .dropdown-menu { + display: block !important; +} + /** Shelving ******************************************************************************/ diff --git a/bookwyrm/templates/components/dropdown.html b/bookwyrm/templates/components/dropdown.html index 98291bc96..b3710271a 100644 --- a/bookwyrm/templates/components/dropdown.html +++ b/bookwyrm/templates/components/dropdown.html @@ -2,25 +2,20 @@ {% load utilities %} {% with 0|uuid as uuid %} -