From 79602f69d71e9f6199e03e2ce1898e511e7e4ae8 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 9 Sep 2021 16:32:21 -0700 Subject: [PATCH] Separate out shelve button options lists --- .../shelve_button/shelve_button_dropdown.html | 2 +- .../shelve_button_dropdown_options.html | 72 ++++++++++++++++ .../shelve_button/shelve_button_options.html | 84 ++++++------------- bookwyrm/templatetags/utilities.py | 4 +- 4 files changed, 99 insertions(+), 63 deletions(-) create mode 100644 bookwyrm/templates/snippets/shelve_button/shelve_button_dropdown_options.html diff --git a/bookwyrm/templates/snippets/shelve_button/shelve_button_dropdown.html b/bookwyrm/templates/snippets/shelve_button/shelve_button_dropdown.html index 353a37a1..43e9591f 100644 --- a/bookwyrm/templates/snippets/shelve_button/shelve_button_dropdown.html +++ b/bookwyrm/templates/snippets/shelve_button/shelve_button_dropdown.html @@ -7,5 +7,5 @@ {% endblock %} {% block dropdown-list %} -{% include 'snippets/shelve_button/shelve_button_options.html' with active_shelf=active_shelf shelves=user_shelves dropdown=True class="shelf-option is-fullwidth is-small is-radiusless is-white" %} +{% include 'snippets/shelve_button/shelve_button_dropdown_options.html' with active_shelf=active_shelf shelves=user_shelves dropdown=True class="shelf-option is-fullwidth is-small is-radiusless is-white" %} {% endblock %} diff --git a/bookwyrm/templates/snippets/shelve_button/shelve_button_dropdown_options.html b/bookwyrm/templates/snippets/shelve_button/shelve_button_dropdown_options.html new file mode 100644 index 00000000..2162a596 --- /dev/null +++ b/bookwyrm/templates/snippets/shelve_button/shelve_button_dropdown_options.html @@ -0,0 +1,72 @@ +{% load bookwyrm_tags %} +{% load utilities %} +{% load i18n %} + +{% with next_shelf_identifier=active_shelf.shelf.identifier|next_shelf %} + +{% for shelf in shelves %} +{% comparison_bool shelf.identifier active_shelf.shelf.identifier as is_current %} + +{% endfor %} + + +{% if dropdown %} + {% if readthrough and active_shelf.shelf.identifier != 'read' %} + + {% endif %} + + {% if active_shelf.shelf %} + + {% endif %} +{% endif %} + +{% endwith %} + diff --git a/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html b/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html index 9cdf150e..39334092 100644 --- a/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html +++ b/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html @@ -4,7 +4,6 @@ {% with next_shelf_identifier=active_shelf.shelf.identifier|next_shelf %} -{% if not dropdown %}
{% trans "Read" %}
-{% endif %} {% for shelf in shelves %} -{% comparison_bool shelf.identifier active_shelf.shelf.identifier boolean=dropdown as is_current %} +
+ {% if shelf.identifier == 'reading' %} - {% if dropdown %}{% endif %} -{% endfor %} - - -{% if dropdown %} - {% if readthrough and active_shelf.shelf.identifier != 'read' %} - - {% endif %} - - {% if active_shelf.shelf %} - + {% endif %} -{% endif %} +
+{% endfor %} {% endwith %} diff --git a/bookwyrm/templatetags/utilities.py b/bookwyrm/templatetags/utilities.py index 173716d2..fe83278a 100644 --- a/bookwyrm/templatetags/utilities.py +++ b/bookwyrm/templatetags/utilities.py @@ -36,9 +36,9 @@ def get_title(book, too_short=5): @register.simple_tag(takes_context=False) -def comparison_bool(str1, str2, boolean=True): +def comparison_bool(str1, str2): """idk why I need to write a tag for this, it returns a bool""" - return boolean and str1 == str2 + return str1 == str2 @register.filter(is_safe=True)