From 82ea04f247804fea25498a524447ecf0bcbecfb4 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 30 Dec 2021 13:37:07 -0800 Subject: [PATCH 01/20] Uses new modals for author sync --- bookwyrm/templates/author/author.html | 9 +++++---- bookwyrm/templates/author/sync_modal.html | 7 ++++--- bookwyrm/templates/components/new_modal.html | 4 +++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/bookwyrm/templates/author/author.html b/bookwyrm/templates/author/author.html index 66ecb062..58e54524 100644 --- a/bookwyrm/templates/author/author.html +++ b/bookwyrm/templates/author/author.html @@ -92,10 +92,11 @@ {% trans "View on OpenLibrary" %} {% if request.user.is_authenticated and perms.bookwyrm.edit_book %} - {% with controls_text="ol_sync" controls_uid=author.id %} - {% include 'snippets/toggle/toggle_button.html' with text=button_text focus="modal_title_ol_sync" class="is-small" icon_with_text="download" %} - {% include "author/sync_modal.html" with source="openlibrary.org" source_name="OpenLibrary" %} - {% endwith %} + + {% include "author/sync_modal.html" with source="openlibrary.org" source_name="OpenLibrary" id="openlibrary_sync" %} {% endif %} {% endif %} diff --git a/bookwyrm/templates/author/sync_modal.html b/bookwyrm/templates/author/sync_modal.html index a061ada8..5d2ff347 100644 --- a/bookwyrm/templates/author/sync_modal.html +++ b/bookwyrm/templates/author/sync_modal.html @@ -1,4 +1,4 @@ -{% extends 'components/modal.html' %} +{% extends 'components/new_modal.html' %} {% load i18n %} {% block modal-title %} @@ -23,8 +23,9 @@ {% trans "Confirm" %} -{% trans "Cancel" as button_text %} -{% include 'snippets/toggle/toggle_button.html' with text=button_text %} + {% endblock %} {% block modal-form-close %}{% endblock %} diff --git a/bookwyrm/templates/components/new_modal.html b/bookwyrm/templates/components/new_modal.html index c4927e52..8bb3cc58 100644 --- a/bookwyrm/templates/components/new_modal.html +++ b/bookwyrm/templates/components/new_modal.html @@ -2,7 +2,7 @@ -
-
-
-
- {% include 'snippets/privacy_select_no_followers.html' with current=group.privacy %} -
-
- -
-
-
+
{% if group.id %} -
- {% trans "Delete group" as button_text %} - {% include 'snippets/toggle/toggle_button.html' with class="is-danger" text=button_text icon_with_text="x" controls_text="delete_group" controls_uid=group.id focus="modal_title_delete_group" %} +
+
{% endif %} +
+
+ {% include 'snippets/privacy_select_no_followers.html' with current=group.privacy %} +
+
+ +
+
From 7af4af278deff11d3b820baa8035dbd2b06e5ecc Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 30 Dec 2021 17:48:09 -0800 Subject: [PATCH 06/20] Readthrough delete modal --- bookwyrm/templates/book/readthrough.html | 23 ++++++++++++------- .../snippets/delete_readthrough_modal.html | 13 +++++++---- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/bookwyrm/templates/book/readthrough.html b/bookwyrm/templates/book/readthrough.html index 12430f75..561853bb 100644 --- a/bookwyrm/templates/book/readthrough.html +++ b/bookwyrm/templates/book/readthrough.html @@ -1,6 +1,7 @@ {% load i18n %} {% load humanize %} {% load tz %} +{% load utilities %}
@@ -10,14 +11,14 @@ {% if readthrough.finish_date or readthrough.progress %}
  • {% if readthrough.finish_date %} - {{ readthrough.finish_date | localtime | naturalday }}: {% trans "finished" %} + {{ readthrough.finish_date | localtime | naturalday }}: {% trans "finished" %} {% else %} - {% if readthrough.progress_mode == 'PG' %} - {% include 'snippets/page_text.html' with page=readthrough.progress total_pages=book.pages %} - {% else %} - {{ readthrough.progress }}% - {% endif %} + {% if readthrough.progress_mode == 'PG' %} + {% include 'snippets/page_text.html' with page=readthrough.progress total_pages=book.pages %} + {% else %} + {{ readthrough.progress }}% + {% endif %} {% endif %} {% if readthrough.progress %} @@ -47,6 +48,7 @@ {% endif %}
  • {% endif %} + {% if readthrough.start_date %}
  • {{ readthrough.start_date | localtime | naturalday }}: {% trans "started" %}
  • {% endif %} @@ -60,7 +62,11 @@
    {% trans "Delete these read dates" as button_text %} - {% include 'snippets/toggle/toggle_button.html' with class="is-small" text=button_text icon="x" controls_text="delete_readthrough" controls_uid=readthrough.id focus="modal_title_delete_readthrough" %} +
    @@ -79,4 +85,5 @@
    -{% include 'snippets/delete_readthrough_modal.html' with controls_text="delete_readthrough" controls_uid=readthrough.id no_body=True %} +{% join "delete_readthrough" readthrough.id as modal_id %} +{% include 'snippets/delete_readthrough_modal.html' with id=modal_id %} diff --git a/bookwyrm/templates/snippets/delete_readthrough_modal.html b/bookwyrm/templates/snippets/delete_readthrough_modal.html index 24d0ff98..217d96d8 100644 --- a/bookwyrm/templates/snippets/delete_readthrough_modal.html +++ b/bookwyrm/templates/snippets/delete_readthrough_modal.html @@ -1,12 +1,18 @@ -{% extends 'components/modal.html' %} +{% extends 'components/new_modal.html' %} {% load i18n %} {% block modal-title %}{% trans "Delete these read dates?" %}{% endblock %} + {% block modal-body %} {% if readthrough.progress_updates|length > 0 %} -{% blocktrans with count=readthrough.progress_updates|length %}You are deleting this readthrough and its {{ count }} associated progress updates.{% endblocktrans %} + {% blocktrans trimmed with count=readthrough.progress_updates|length %} + You are deleting this readthrough and its {{ count }} associated progress updates. + {% endblocktrans %} +{% else %} + {% trans "This action cannot be un-done" %} {% endif %} {% endblock %} + {% block modal-footer %}
    {% csrf_token %} @@ -14,7 +20,6 @@ - {% trans "Cancel" as button_text %} - {% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="delete_readthrough" controls_uid=readthrough.id %} +
    {% endblock %} From 65c719d2d4d4cb89b45bdd7d7ca783e19b5a8c1c Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 30 Dec 2021 17:49:41 -0800 Subject: [PATCH 07/20] Move readthrough delete modal into books dir --- .../templates/{snippets => book}/delete_readthrough_modal.html | 0 bookwyrm/templates/book/readthrough.html | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename bookwyrm/templates/{snippets => book}/delete_readthrough_modal.html (100%) diff --git a/bookwyrm/templates/snippets/delete_readthrough_modal.html b/bookwyrm/templates/book/delete_readthrough_modal.html similarity index 100% rename from bookwyrm/templates/snippets/delete_readthrough_modal.html rename to bookwyrm/templates/book/delete_readthrough_modal.html diff --git a/bookwyrm/templates/book/readthrough.html b/bookwyrm/templates/book/readthrough.html index 561853bb..e711ecd0 100644 --- a/bookwyrm/templates/book/readthrough.html +++ b/bookwyrm/templates/book/readthrough.html @@ -86,4 +86,4 @@ {% join "delete_readthrough" readthrough.id as modal_id %} -{% include 'snippets/delete_readthrough_modal.html' with id=modal_id %} +{% include 'book/delete_readthrough_modal.html' with id=modal_id %} From a576b128c34424f9952f96dc1a023519512ef84e Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 30 Dec 2021 18:06:33 -0800 Subject: [PATCH 08/20] Updates reading modals --- .../templates/snippets/reading_modals/layout.html | 2 +- bookwyrm/templates/snippets/shelf_selector.html | 9 ++++++--- .../snippets/shelve_button/shelve_button.html | 12 ++++++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/bookwyrm/templates/snippets/reading_modals/layout.html b/bookwyrm/templates/snippets/reading_modals/layout.html index 89cc9a2e..8f041304 100644 --- a/bookwyrm/templates/snippets/reading_modals/layout.html +++ b/bookwyrm/templates/snippets/reading_modals/layout.html @@ -1,4 +1,4 @@ -{% extends 'components/modal.html' %} +{% extends 'components/new_modal.html' %} {% load i18n %} {% load utilities %} diff --git a/bookwyrm/templates/snippets/shelf_selector.html b/bookwyrm/templates/snippets/shelf_selector.html index f96f48a8..aacaf5a2 100644 --- a/bookwyrm/templates/snippets/shelf_selector.html +++ b/bookwyrm/templates/snippets/shelf_selector.html @@ -86,11 +86,14 @@ {% endif %} -{% include 'snippets/reading_modals/want_to_read_modal.html' with book=active_shelf.book controls_text="want_to_read" controls_uid=uuid move_from=current.id refresh=True class="" %} +{% join "want_to_read" uuid as modal_id %} +{% include 'snippets/reading_modals/want_to_read_modal.html' with book=active_shelf.book id=modal_id move_from=current.id refresh=True class="" %} -{% include 'snippets/reading_modals/start_reading_modal.html' with book=active_shelf.book controls_text="start_reading" controls_uid=uuid move_from=current.id refresh=True class="" %} +{% join "start_reading" uuid as modal_id %} +{% include 'snippets/reading_modals/start_reading_modal.html' with book=active_shelf.book id=modal_id move_from=current.id refresh=True class="" %} -{% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf.book controls_text="finish_reading" controls_uid=uuid move_from=current.id readthrough=readthrough refresh=True class="" %} +{% join "finish_reading" uuid as modal_id %} +{% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf.book id=modal_id move_from=current.id readthrough=readthrough refresh=True class="" %} {% endwith %} {% endblock %} diff --git a/bookwyrm/templates/snippets/shelve_button/shelve_button.html b/bookwyrm/templates/snippets/shelve_button/shelve_button.html index b70ba1b9..f27c1859 100644 --- a/bookwyrm/templates/snippets/shelve_button/shelve_button.html +++ b/bookwyrm/templates/snippets/shelve_button/shelve_button.html @@ -19,13 +19,17 @@ {% endif %} -{% include 'snippets/reading_modals/want_to_read_modal.html' with book=active_shelf.book controls_text="want_to_read" controls_uid=uuid %} +{% join "want_to_read" uuid as modal_id %} +{% include 'snippets/reading_modals/want_to_read_modal.html' with book=active_shelf.book id=modal_id %} -{% include 'snippets/reading_modals/start_reading_modal.html' with book=active_shelf.book controls_text="start_reading" controls_uid=uuid %} +{% join "start_reading" uuid as modal_id %} +{% include 'snippets/reading_modals/start_reading_modal.html' with book=active_shelf.book id=modal_id %} -{% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf.book controls_text="finish_reading" controls_uid=uuid readthrough=readthrough %} +{% join "finish_reading" uuid as modal_id %} +{% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf.book id=modal_id readthrough=readthrough %} -{% include 'snippets/reading_modals/progress_update_modal.html' with book=active_shelf.book controls_text="progress_update" controls_uid=uuid readthrough=readthrough %} +{% join "progress_update" uuid as modal_id %} +{% include 'snippets/reading_modals/progress_update_modal.html' with book=active_shelf.book id=modal_id readthrough=readthrough %} {% endwith %} {% endif %} From 5f3a5c87b6bdc2d46cf7eca8827e984f09c31571 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 30 Dec 2021 18:37:49 -0800 Subject: [PATCH 09/20] Update report modal --- bookwyrm/templates/snippets/report_button.html | 14 ++++++++++---- bookwyrm/templates/snippets/report_modal.html | 14 +++++++++----- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/bookwyrm/templates/snippets/report_button.html b/bookwyrm/templates/snippets/report_button.html index 2638a9ff..6b4a3f25 100644 --- a/bookwyrm/templates/snippets/report_button.html +++ b/bookwyrm/templates/snippets/report_button.html @@ -3,9 +3,15 @@ {% with 0|uuid as report_uuid %} -{% trans "Report" as button_text %} -{% include 'snippets/toggle/toggle_button.html' with class="is-danger is-light is-small is-fullwidth" text=button_text controls_text="report" controls_uid=report_uuid focus="modal_title_report" disabled=is_current %} - -{% include 'snippets/report_modal.html' with user=user reporter=request.user controls_text="report" controls_uid=report_uuid %} +{% join "report" report_uuid as modal_id %} + +{% include 'snippets/report_modal.html' with user=user reporter=request.user id=modal_id %} {% endwith %} diff --git a/bookwyrm/templates/snippets/report_modal.html b/bookwyrm/templates/snippets/report_modal.html index 0d6504ab..615f13cc 100644 --- a/bookwyrm/templates/snippets/report_modal.html +++ b/bookwyrm/templates/snippets/report_modal.html @@ -1,4 +1,4 @@ -{% extends 'components/modal.html' %} +{% extends 'components/new_modal.html' %} {% load i18n %} {% load humanize %} @@ -21,8 +21,12 @@

    {% blocktrans with site_name=site.name %}This report will be sent to {{ site_name }}'s moderators for review.{% endblocktrans %}

    - - +
    + + +
    {% endblock %} @@ -31,9 +35,9 @@ {% block modal-footer %} -{% trans "Cancel" as button_text %} -{% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="report" controls_uid=report_uuid class="" %} + {% endblock %} + {% block modal-form-close %}{% endblock %} From e3321c9badef2aba004a16c3ff2a1a1427a53e67 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 30 Dec 2021 18:27:33 -0800 Subject: [PATCH 10/20] Updates buttons to call modals in shelve buttons --- .../templates/snippets/shelve_button/modal_button.html | 10 ++++++++++ .../snippets/shelve_button/shelve_button.html | 10 +++++----- .../snippets/shelve_button/shelve_button_options.html | 9 ++++++--- 3 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 bookwyrm/templates/snippets/shelve_button/modal_button.html diff --git a/bookwyrm/templates/snippets/shelve_button/modal_button.html b/bookwyrm/templates/snippets/shelve_button/modal_button.html new file mode 100644 index 00000000..a745b4fb --- /dev/null +++ b/bookwyrm/templates/snippets/shelve_button/modal_button.html @@ -0,0 +1,10 @@ +{% load utilities %} +
    + +
    diff --git a/bookwyrm/templates/snippets/shelve_button/shelve_button.html b/bookwyrm/templates/snippets/shelve_button/shelve_button.html index f27c1859..38f6be38 100644 --- a/bookwyrm/templates/snippets/shelve_button/shelve_button.html +++ b/bookwyrm/templates/snippets/shelve_button/shelve_button.html @@ -6,7 +6,7 @@ {% with book.id|uuid as uuid %} {% active_shelf book as active_shelf %} {% latest_read_through book request.user as readthrough %} -
    +
    {% if switch_mode and active_shelf.book != book %}
    {% include 'snippets/switch_edition_button.html' with edition=book size='is-small' %} @@ -20,16 +20,16 @@
    {% join "want_to_read" uuid as modal_id %} -{% include 'snippets/reading_modals/want_to_read_modal.html' with book=active_shelf.book id=modal_id %} +{% include 'snippets/reading_modals/want_to_read_modal.html' with book=active_shelf.book id=modal_id class="" %} {% join "start_reading" uuid as modal_id %} -{% include 'snippets/reading_modals/start_reading_modal.html' with book=active_shelf.book id=modal_id %} +{% include 'snippets/reading_modals/start_reading_modal.html' with book=active_shelf.book id=modal_id class="" %} {% join "finish_reading" uuid as modal_id %} -{% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf.book id=modal_id readthrough=readthrough %} +{% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf.book id=modal_id readthrough=readthrough class="" %} {% join "progress_update" uuid as modal_id %} -{% include 'snippets/reading_modals/progress_update_modal.html' with book=active_shelf.book id=modal_id readthrough=readthrough %} +{% include 'snippets/reading_modals/progress_update_modal.html' with book=active_shelf.book id=modal_id readthrough=readthrough class="" %} {% endwith %} {% endif %} diff --git a/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html b/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html index de50b53e..add2a77c 100644 --- a/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html +++ b/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html @@ -23,19 +23,22 @@ {% trans "Start reading" as button_text %} {% url 'reading-status' 'start' book.id as fallback_url %} - {% include 'snippets/toggle/toggle_button.html' with class=class text=button_text controls_text="start_reading" controls_uid=button_uuid focus="modal_title_start_reading" fallback_url=fallback_url %} + {% join "start_reading" button_uuid as modal_id %} + {% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %} {% elif shelf.identifier == 'read' %} {% trans "Finish reading" as button_text %} {% url 'reading-status' 'finish' book.id as fallback_url %} - {% include 'snippets/toggle/toggle_button.html' with class=class text=button_text controls_text="finish_reading" controls_uid=button_uuid focus="modal_title_finish_reading" fallback_url=fallback_url %} + {% join "finish_reading" button_uuid as modal_id %} + {% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %} {% elif shelf.identifier == 'to-read' %} {% trans "Want to read" as button_text %} {% url 'reading-status' 'want' book.id as fallback_url %} - {% include 'snippets/toggle/toggle_button.html' with class=class text=button_text controls_text="want_to_read" controls_uid=button_uuid focus="modal_title_want_to_read" fallback_url=fallback_url %} + {% join "want_to_read" button_uuid as modal_id %} + {% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %} {% elif shelf.editable %} From 8ad75084de011637f35f73fea903f26c16caa6d4 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 30 Dec 2021 18:56:37 -0800 Subject: [PATCH 11/20] Force state for active modal --- bookwyrm/templates/components/new_modal.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/templates/components/new_modal.html b/bookwyrm/templates/components/new_modal.html index 8bb3cc58..38cfc699 100644 --- a/bookwyrm/templates/components/new_modal.html +++ b/bookwyrm/templates/components/new_modal.html @@ -1,6 +1,6 @@ {% load i18n %} -