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

64 lines
2.2 KiB
HTML
Raw Normal View History

2021-05-11 21:41:28 +00:00
{% load utilities %}
2022-01-18 19:20:27 +00:00
{% load shelf_tags %}
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
<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>
{% for shelf in shelves %}
<div
class="{% if next_shelf_identifier != shelf.identifier %}is-hidden{% endif %}"
data-shelf-identifier="{{ shelf.identifier }}"
data-shelf-next="{{ shelf.identifier|next_shelf }}"
>
{% if shelf.identifier == 'reading' %}
{% trans "Start reading" as button_text %}
{% url 'reading-status' 'start' book.id as fallback_url %}
{% join "start_reading" button_uuid as modal_id %}
{% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %}
2021-06-08 19:40:01 +00:00
{% elif shelf.identifier == 'read' %}
2021-06-08 19:40:01 +00:00
{% trans "Finish reading" as button_text %}
{% url 'reading-status' 'finish' book.id as fallback_url %}
{% join "finish_reading" button_uuid as modal_id %}
{% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %}
2021-06-08 19:40:01 +00:00
{% elif shelf.identifier == 'to-read' %}
2021-06-08 19:40:01 +00:00
{% trans "Want to read" as button_text %}
{% url 'reading-status' 'want' book.id as 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 %}
2021-12-29 19:31:26 +00:00
<form name="shelve-{{ uuid }}-{{ shelf.identifier }}" action="/shelve/" method="post">
2021-01-30 19:52:31 +00:00
{% csrf_token %}
<input type="hidden" name="book" value="{{ active_shelf.book.id }}">
<button
class="button {{ class }}"
name="shelf"
type="submit"
value="{{ shelf.identifier }}"
{% if book|is_book_on_shelf:shelf %} disabled {% endif %}
>
<span>{{ shelf.name }}</span>
2021-01-30 19:52:31 +00:00
</button>
</form>
2021-01-30 19:52:31 +00:00
{% endif %}
</div>
{% endfor %}
2021-03-29 19:27:12 +00:00
{% endwith %}