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 bc1034a8..0ef876fd 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 40da6486..53be123d 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 8ebbeaae..095439d1 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 efbe1566..8af85ace 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 542b57f9..ded8c494 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 75fc1951..431cf6dd 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 9613508b..e3fd87bb 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 661d8078..1aa76202 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 095439d1..644e90c6 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 00000000..abfadaaf --- /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 c5be295e..256fcea5 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 ca65bf06..6d4ea5ea 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 21341683..47d620e0 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 8ebbeaae..bcf11126 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 efbe1566..775b05c8 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 1808a0f9..7def6e13 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 ad7e00fb..73133de4 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 542b57f9..b575bbb2 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 1e361e61..0b7dcd79 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 239b6914..c4f0dfae 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 3ce929e6..e06392a8 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 c45f2380..bc654401 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 ba0a25cd..73ad23b8 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 d463d9cb..baf87e47 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 9459b0fe..476956b6 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 6014158f..ddbd6f20 100644 --- a/bookwyrm/templates/snippets/status/layout.html +++ b/bookwyrm/templates/snippets/status/layout.html @@ -44,7 +44,7 @@ {% else %}