From e5fd14b2067b54a095bd374cdccbbb215ca8b52e Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 30 Jan 2021 13:11:43 -0800 Subject: [PATCH] Confirmation modal for to-read shelve action --- bookwyrm/templates/components/modal.html | 4 ++- .../templates/snippets/shelve_button.html | 4 ++- .../snippets/shelve_button_options.html | 4 ++- .../snippets/want_to_read_modal.html | 30 +++++++++++++++++++ bookwyrm/templatetags/bookwyrm_tags.py | 4 +++ 5 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 bookwyrm/templates/snippets/want_to_read_modal.html diff --git a/bookwyrm/templates/components/modal.html b/bookwyrm/templates/components/modal.html index 72402914..554f9ccd 100644 --- a/bookwyrm/templates/components/modal.html +++ b/bookwyrm/templates/components/modal.html @@ -8,15 +8,17 @@ {% include 'snippets/toggle/toggle_button.html' with label="close" class="delete" nonbutton=True %} {% block modal-form-open %}{% endblock %} + {% if not no_body %} + {% endif %} {% block modal-form-close %}{% endblock %} - + {% include 'snippets/toggle/toggle_button.html' with label="close" class="modal-close is-large" nonbutton=True %} diff --git a/bookwyrm/templates/snippets/shelve_button.html b/bookwyrm/templates/snippets/shelve_button.html index 946368c2..769da50f 100644 --- a/bookwyrm/templates/snippets/shelve_button.html +++ b/bookwyrm/templates/snippets/shelve_button.html @@ -10,12 +10,14 @@ {% else %}
- {% include 'snippets/shelve_button_options.html' with class="shelf-option is-small" shelves=request.user.shelf_set.all active_shelf=active_shelf %} + {% include 'snippets/shelve_button_options.html' with class="shelf-option is-small" shelves=request.user.shelf_set.all active_shelf=active_shelf button_uuid=uuid %}
{% include 'snippets/shelve_button_dropdown.html' with class="is-small" button_uuid=uuid%} {% endif %} +{% include 'snippets/want_to_read_modal.html' with book=active_shelf.book controls_text="want-to-read" controls_uid=uuid no_body=True %} + {% include 'snippets/start_reading_modal.html' with book=active_shelf.book controls_text="start-reading" controls_uid=uuid %} {% latest_read_through book request.user as readthrough %} diff --git a/bookwyrm/templates/snippets/shelve_button_options.html b/bookwyrm/templates/snippets/shelve_button_options.html index 84133400..af47ee23 100644 --- a/bookwyrm/templates/snippets/shelve_button_options.html +++ b/bookwyrm/templates/snippets/shelve_button_options.html @@ -5,10 +5,12 @@ + +{% endblock %} +{% block modal-form-close %}{% endblock %} diff --git a/bookwyrm/templatetags/bookwyrm_tags.py b/bookwyrm/templatetags/bookwyrm_tags.py index c1a2d14e..0a699129 100644 --- a/bookwyrm/templatetags/bookwyrm_tags.py +++ b/bookwyrm/templatetags/bookwyrm_tags.py @@ -161,10 +161,13 @@ def get_status_preview_name(obj): @register.filter(name='next_shelf') def get_next_shelf(current_shelf): + ''' shelf you'd use to update reading progress ''' if current_shelf == 'to-read': return 'reading' if current_shelf == 'reading': return 'read' + if current_shelf == 'read': + return 'read' return 'to-read' @register.simple_tag(takes_context=False) @@ -211,4 +214,5 @@ def active_read_through(book, user): @register.simple_tag(takes_context=False) def comparison_bool(str1, str2): + ''' idk why I need to write a tag for this, it reutrns a bool ''' return str1 == str2