From 33ca7b4b763c118cf84ee85205e64ccd1355b220 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 4 May 2021 08:54:53 -0700 Subject: [PATCH 1/8] Adds datepicker script dependencies to templates --- bookwyrm/templates/author.html | 3 +++ bookwyrm/templates/book/book.html | 1 + bookwyrm/templates/book/edit_book.html | 8 ++++++-- bookwyrm/templates/book/editions.html | 4 ++++ bookwyrm/templates/edit_author.html | 4 ++++ bookwyrm/templates/feed/feed_layout.html | 1 + bookwyrm/templates/get_started/books.html | 4 ++++ bookwyrm/templates/user/layout.html | 5 +++++ 8 files changed, 28 insertions(+), 2 deletions(-) diff --git a/bookwyrm/templates/author.html b/bookwyrm/templates/author.html index bc1034a8d..0ef876fd3 100644 --- a/bookwyrm/templates/author.html +++ b/bookwyrm/templates/author.html @@ -39,3 +39,6 @@ {% endblock %} +{% block scripts %} +{% include 'snippets/datepicker_js.html' %} +{% endblock %} diff --git a/bookwyrm/templates/book/book.html b/bookwyrm/templates/book/book.html index 40da64861..53be123d8 100644 --- a/bookwyrm/templates/book/book.html +++ b/bookwyrm/templates/book/book.html @@ -333,4 +333,5 @@ {% block scripts %} +{% include 'snippets/datepicker_js.html' %} {% endblock %} diff --git a/bookwyrm/templates/book/edit_book.html b/bookwyrm/templates/book/edit_book.html index 8ebbeaae6..095439d14 100644 --- a/bookwyrm/templates/book/edit_book.html +++ b/bookwyrm/templates/book/edit_book.html @@ -133,7 +133,7 @@

- +

{% for error in form.first_published_date.errors %}

{{ error | escape }}

@@ -141,7 +141,7 @@

- +

{% for error in form.published_date.errors %}

{{ error | escape }}

@@ -245,3 +245,7 @@ {% endblock %} + +{% block scripts %} +{% include 'snippets/datepicker_js.html' %} +{% endblock %} diff --git a/bookwyrm/templates/book/editions.html b/bookwyrm/templates/book/editions.html index efbe15663..8af85aced 100644 --- a/bookwyrm/templates/book/editions.html +++ b/bookwyrm/templates/book/editions.html @@ -51,3 +51,7 @@ {% include 'snippets/pagination.html' with page=editions path=request.path %} {% endblock %} + +{% block scripts %} +{% include 'snippets/datepicker_js.html' %} +{% endblock %} diff --git a/bookwyrm/templates/edit_author.html b/bookwyrm/templates/edit_author.html index 542b57f95..ded8c4944 100644 --- a/bookwyrm/templates/edit_author.html +++ b/bookwyrm/templates/edit_author.html @@ -81,3 +81,7 @@ {% endblock %} + +{% block scripts %} +{% include 'snippets/datepicker_js.html' %} +{% endblock %} diff --git a/bookwyrm/templates/feed/feed_layout.html b/bookwyrm/templates/feed/feed_layout.html index 75fc1951a..431cf6dd7 100644 --- a/bookwyrm/templates/feed/feed_layout.html +++ b/bookwyrm/templates/feed/feed_layout.html @@ -105,4 +105,5 @@ {% block scripts %} +{% include 'snippets/datepicker_js.html' %} {% endblock %} diff --git a/bookwyrm/templates/get_started/books.html b/bookwyrm/templates/get_started/books.html index 9613508b9..e3fd87bbd 100644 --- a/bookwyrm/templates/get_started/books.html +++ b/bookwyrm/templates/get_started/books.html @@ -64,3 +64,7 @@ {% endblock %} + +{% block scripts %} +{% include 'snippets/datepicker_js.html' %} +{% endblock %} diff --git a/bookwyrm/templates/user/layout.html b/bookwyrm/templates/user/layout.html index 661d80781..1aa762027 100644 --- a/bookwyrm/templates/user/layout.html +++ b/bookwyrm/templates/user/layout.html @@ -81,3 +81,8 @@ {% block panel %}{% endblock %} {% endblock %} + + +{% block scripts %} +{% include 'snippets/datepicker_js.html' %} +{% endblock %} From 869cfa6d341f25ee25d8576adcdc2e3b8d239b9c Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 4 May 2021 09:04:21 -0700 Subject: [PATCH 2/8] Replaces date elements with datepicker --- bookwyrm/templates/book/edit_book.html | 12 ++++++++++-- bookwyrm/templates/snippets/datepicker_js.html | 3 +++ bookwyrm/templates/snippets/readthrough_form.html | 12 ++++++++++-- .../snippets/shelve_button/finish_reading_modal.html | 12 ++++++++++-- .../snippets/shelve_button/start_reading_modal.html | 6 +++++- 5 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 bookwyrm/templates/snippets/datepicker_js.html diff --git a/bookwyrm/templates/book/edit_book.html b/bookwyrm/templates/book/edit_book.html index 095439d14..644e90c6e 100644 --- a/bookwyrm/templates/book/edit_book.html +++ b/bookwyrm/templates/book/edit_book.html @@ -133,7 +133,11 @@

- +

{% for error in form.first_published_date.errors %}

{{ error | escape }}

@@ -141,7 +145,11 @@

- +

{% for error in form.published_date.errors %}

{{ error | escape }}

diff --git a/bookwyrm/templates/snippets/datepicker_js.html b/bookwyrm/templates/snippets/datepicker_js.html new file mode 100644 index 000000000..abfadaaf8 --- /dev/null +++ b/bookwyrm/templates/snippets/datepicker_js.html @@ -0,0 +1,3 @@ + + + diff --git a/bookwyrm/templates/snippets/readthrough_form.html b/bookwyrm/templates/snippets/readthrough_form.html index c5be295e1..256fcea54 100644 --- a/bookwyrm/templates/snippets/readthrough_form.html +++ b/bookwyrm/templates/snippets/readthrough_form.html @@ -5,7 +5,11 @@
{# Only show progress for editing existing readthroughs #} @@ -28,6 +32,10 @@
diff --git a/bookwyrm/templates/snippets/shelve_button/finish_reading_modal.html b/bookwyrm/templates/snippets/shelve_button/finish_reading_modal.html index ca65bf06c..6d4ea5eac 100644 --- a/bookwyrm/templates/snippets/shelve_button/finish_reading_modal.html +++ b/bookwyrm/templates/snippets/shelve_button/finish_reading_modal.html @@ -17,13 +17,21 @@
diff --git a/bookwyrm/templates/snippets/shelve_button/start_reading_modal.html b/bookwyrm/templates/snippets/shelve_button/start_reading_modal.html index 213416836..47d620e0d 100644 --- a/bookwyrm/templates/snippets/shelve_button/start_reading_modal.html +++ b/bookwyrm/templates/snippets/shelve_button/start_reading_modal.html @@ -15,7 +15,11 @@
From 748810cd419915b34849d8255fd9b4dfb71bc5fc Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 4 May 2021 09:34:16 -0700 Subject: [PATCH 3/8] Use reverse lookups for urls --- bookwyrm/templates/book/edit_book.html | 2 +- bookwyrm/templates/book/editions.html | 4 ++-- bookwyrm/templates/discover/large-book.html | 2 +- bookwyrm/templates/discover/small-book.html | 2 +- bookwyrm/templates/edit_author.html | 2 +- bookwyrm/templates/feed/direct_messages.html | 2 +- bookwyrm/templates/import.html | 2 +- bookwyrm/templates/import_status.html | 2 +- bookwyrm/templates/layout.html | 12 ++++++------ bookwyrm/templates/login.html | 4 ++-- bookwyrm/templates/notifications.html | 2 +- .../preferences/preferences_layout.html | 9 ++++++--- bookwyrm/templates/snippets/authors.html | 2 +- bookwyrm/templates/snippets/book_tiles.html | 2 +- bookwyrm/templates/snippets/status/layout.html | 2 +- .../templates/snippets/status/status_header.html | 8 ++++---- bookwyrm/templates/snippets/user_options.html | 2 +- bookwyrm/urls.py | 16 ++++++++++------ 18 files changed, 42 insertions(+), 35 deletions(-) diff --git a/bookwyrm/templates/book/edit_book.html b/bookwyrm/templates/book/edit_book.html index 8ebbeaae6..bcf111267 100644 --- a/bookwyrm/templates/book/edit_book.html +++ b/bookwyrm/templates/book/edit_book.html @@ -239,7 +239,7 @@ {% if not confirm_mode %} {% endif %} diff --git a/bookwyrm/templates/book/editions.html b/bookwyrm/templates/book/editions.html index efbe15663..775b05c86 100644 --- a/bookwyrm/templates/book/editions.html +++ b/bookwyrm/templates/book/editions.html @@ -15,14 +15,14 @@ {% for book in editions %}

- + {{ book.title }}

diff --git a/bookwyrm/templates/discover/large-book.html b/bookwyrm/templates/discover/large-book.html index 1808a0f9d..7def6e138 100644 --- a/bookwyrm/templates/discover/large-book.html +++ b/bookwyrm/templates/discover/large-book.html @@ -17,7 +17,7 @@

- {{ book.title }} + {{ book.title }}

{% if book.authors %} diff --git a/bookwyrm/templates/discover/small-book.html b/bookwyrm/templates/discover/small-book.html index ad7e00fba..73133de45 100644 --- a/bookwyrm/templates/discover/small-book.html +++ b/bookwyrm/templates/discover/small-book.html @@ -11,7 +11,7 @@ {% include 'snippets/stars.html' with rating=book|rating:request.user %}

- {{ book.title }} + {{ book.title }}

{% if book.authors %} diff --git a/bookwyrm/templates/edit_author.html b/bookwyrm/templates/edit_author.html index 542b57f95..b575bbb2f 100644 --- a/bookwyrm/templates/edit_author.html +++ b/bookwyrm/templates/edit_author.html @@ -76,7 +76,7 @@ diff --git a/bookwyrm/templates/feed/direct_messages.html b/bookwyrm/templates/feed/direct_messages.html index 1e361e614..0b7dcd79c 100644 --- a/bookwyrm/templates/feed/direct_messages.html +++ b/bookwyrm/templates/feed/direct_messages.html @@ -10,7 +10,7 @@ {% trans "Direct Messages" %} {% endif %} - {% if partner %}

{% trans "All messages" %}

{% endif %} + {% if partner %}

{% trans "All messages" %}

{% endif %}
diff --git a/bookwyrm/templates/import.html b/bookwyrm/templates/import.html index 239b6914d..c4f0dfae4 100644 --- a/bookwyrm/templates/import.html +++ b/bookwyrm/templates/import.html @@ -56,7 +56,7 @@ {% endif %}
diff --git a/bookwyrm/templates/import_status.html b/bookwyrm/templates/import_status.html index 3ce929e6a..e06392a8e 100644 --- a/bookwyrm/templates/import_status.html +++ b/bookwyrm/templates/import_status.html @@ -124,7 +124,7 @@ {% if item.book %} - + {% include 'snippets/book_cover.html' with book=item.book cover_class='is-h-s' %} {% endif %} diff --git a/bookwyrm/templates/layout.html b/bookwyrm/templates/layout.html index c45f23804..bc6544012 100644 --- a/bookwyrm/templates/layout.html +++ b/bookwyrm/templates/layout.html @@ -94,12 +94,12 @@
  • - + {% trans 'Import Books' %}
  • - + {% trans 'Settings' %}
  • @@ -122,14 +122,14 @@ {% endif %}
  • - + {% trans 'Log out' %}
  • diff --git a/bookwyrm/templates/notifications.html b/bookwyrm/templates/notifications.html index ba0a25cd0..73ad23b8a 100644 --- a/bookwyrm/templates/notifications.html +++ b/bookwyrm/templates/notifications.html @@ -107,7 +107,7 @@ {% endif %} {% endif %} {% elif notification.related_import %} - {% blocktrans with related_id=notification.related_import.id %}Your import completed.{% endblocktrans %} + {% blocktrans with related_id=notification.related_import.id %}Your import completed.{% endblocktrans %} {% elif notification.related_report %} {% url 'settings-report' notification.related_report.id as path %} {% blocktrans with related_id=path %}A new report needs moderation.{% endblocktrans %} diff --git a/bookwyrm/templates/preferences/preferences_layout.html b/bookwyrm/templates/preferences/preferences_layout.html index d463d9cba..baf87e478 100644 --- a/bookwyrm/templates/preferences/preferences_layout.html +++ b/bookwyrm/templates/preferences/preferences_layout.html @@ -11,16 +11,19 @@ diff --git a/bookwyrm/templates/snippets/authors.html b/bookwyrm/templates/snippets/authors.html index 9459b0fe4..476956b6e 100644 --- a/bookwyrm/templates/snippets/authors.html +++ b/bookwyrm/templates/snippets/authors.html @@ -5,7 +5,7 @@ {% endcomment %} {% for author in book.authors.all %}
    diff --git a/bookwyrm/templates/snippets/status/layout.html b/bookwyrm/templates/snippets/status/layout.html index 6014158ff..ddbd6f20f 100644 --- a/bookwyrm/templates/snippets/status/layout.html +++ b/bookwyrm/templates/snippets/status/layout.html @@ -44,7 +44,7 @@ {% else %}