From a576b128c34424f9952f96dc1a023519512ef84e Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 30 Dec 2021 18:06:33 -0800 Subject: [PATCH 1/7] 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 e3321c9badef2aba004a16c3ff2a1a1427a53e67 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 30 Dec 2021 18:27:33 -0800 Subject: [PATCH 2/7] 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 3/7] 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 %} -