moviewyrm/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html

91 lines
4 KiB
HTML
Raw Normal View History

2021-01-30 19:52:31 +00:00
{% load bookwyrm_tags %}
2021-05-11 21:41:28 +00:00
{% load utilities %}
2021-02-28 02:48:10 +00:00
{% load i18n %}
2021-05-11 21:41:28 +00:00
{% with next_shelf_identifier=active_shelf.shelf.identifier|next_shelf %}
2021-06-08 19:40:01 +00:00
{% if not dropdown %}
<div
class="{% if next_shelf_identifier != 'complete' %}is-hidden{% endif %}"
data-shelf-identifier="complete"
>
<button type="button" class="button {{ class }}" disabled>
<span>{% trans "Read" %}</span>
</button>
</div>
{% endif %}
{% for shelf in shelves %}
{% comparison_bool shelf.identifier active_shelf.shelf.identifier boolean=dropdown as is_current %}
{% if dropdown %}<li role="menuitem" class="dropdown-item p-0">{% endif %}
2021-06-08 19:40:01 +00:00
<div
class="{% if not dropdown and next_shelf_identifier != shelf.identifier %}is-hidden{% endif %}"
data-shelf-identifier="{{ shelf.identifier }}"
data-shelf-next="{{ shelf.identifier|next_shelf }}"
>
{% if shelf.identifier == 'reading' %}
{% if not dropdown or next_shelf_identifier != shelf.identifier %}
2021-06-08 19:40:01 +00:00
{% 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" disabled=is_current fallback_url=fallback_url %}
2021-06-08 19:40:01 +00:00
{% endif %}
{% elif shelf.identifier == 'read' %}
{% if not dropdown or next_shelf_identifier != shelf.identifier %}
2021-06-08 19:40:01 +00:00
{% 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" disabled=is_current fallback_url=fallback_url %}
{% endif %}
{% elif shelf.identifier == 'to-read' %}
{% if not dropdown or next_shelf_identifier != shelf.identifier %}
{% 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" disabled=is_current fallback_url=fallback_url %}
{% endif %}
{% elif shelf.editable %}
<form name="shelve" action="/shelve/" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="{{ active_shelf.book.id }}">
<button class="button {{ class }}" name="shelf" type="submit" value="{{ shelf.identifier }}" {% if shelf in book.shelf_set.all %} disabled {% endif %}>
<span>{{ shelf.name }}</span>
</button>
</form>
{% endif %}
</div>
{% if dropdown %}</li>{% endif %}
{% endfor %}
{% if dropdown %}
{% if readthrough and active_shelf.shelf.identifier != 'read' %}
<li role="menuitem" class="dropdown-item p-0">
{% trans "Update progress" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with class=class text=button_text controls_text="progress_update" controls_uid=button_uuid focus="modal_title_progress_update" %}
</li>
{% endif %}
{% if active_shelf.shelf %}
<li role="menuitem" class="dropdown-item p-0">
<form name="shelve" action="/unshelve/" method="post">
2021-01-30 19:52:31 +00:00
{% csrf_token %}
<input type="hidden" name="book" value="{{ active_shelf.book.id }}">
<input type="hidden" name="shelf" value="{{ active_shelf.shelf.id }}">
<button class="button is-fullwidth is-small{% if dropdown %} is-radiusless{% endif %} is-danger is-light" type="submit">
{% blocktrans with name=active_shelf.shelf.name %}Remove from {{ name }}{% endblocktrans %}
2021-01-30 19:52:31 +00:00
</button>
</form>
</li>
2021-01-30 19:52:31 +00:00
{% endif %}
2021-03-21 00:18:18 +00:00
{% endif %}
2021-03-29 19:27:12 +00:00
{% endwith %}