forked from mirrors/bookwyrm
96 lines
4.3 KiB
HTML
96 lines
4.3 KiB
HTML
{% extends 'components/dropdown.html' %}
|
|
{% load i18n %}
|
|
{% load bookwyrm_tags %}
|
|
{% load utilities %}
|
|
|
|
{% block dropdown-trigger %}
|
|
<span>{% trans "Move book" %}</span>
|
|
<span class="icon icon-arrow-down" aria-hidden="true"></span>
|
|
{% endblock %}
|
|
|
|
{% block dropdown-list %}
|
|
{% with book.id|uuid as uuid %}
|
|
{% active_shelf book as active_shelf %}
|
|
{% latest_read_through book request.user as readthrough %}
|
|
|
|
{% for shelf in user_shelves %}
|
|
|
|
{% if shelf.editable %}
|
|
<li role="menuitem" class="dropdown-item p-0">
|
|
<form name="shelve" action="/shelve/" method="post">
|
|
{% csrf_token %}
|
|
<input type="hidden" name="book" value="{{ book.id }}">
|
|
<input type="hidden" name="change-shelf-from" value="{{ current.identifier }}">
|
|
<input type="hidden" name="shelf" value="{{ shelf.identifier }}">
|
|
|
|
<button class="button is-fullwidth is-small shelf-option is-radiusless is-white" type="submit" {% if shelf.identifier == current.identifier %}disabled{% endif %}>
|
|
<span>
|
|
{% if shelf.identifier == 'to-read' %}{% trans "To Read" %}
|
|
{% elif shelf.identifier == 'reading' %}{% trans "Currently Reading" %}
|
|
{% elif shelf.identifier == 'read' %}{% trans "Read" %}
|
|
{% else %}{{ shelf.name }}{% endif %}
|
|
</span>
|
|
</button>
|
|
</form>
|
|
</li>
|
|
{% else%}
|
|
{% comparison_bool shelf.identifier active_shelf.shelf.identifier as is_current %}
|
|
{% with button_class="is-fullwidth is-small shelf-option is-radiusless is-white" %}
|
|
<li role="menuitem" class="dropdown-item p-0">
|
|
{% if shelf.identifier == 'reading' %}
|
|
|
|
{% trans "Start reading" as button_text %}
|
|
{% url 'reading-status' 'start' book.id as fallback_url %}
|
|
{% include 'snippets/toggle/toggle_button.html' with class=button_class text=button_text controls_text="start_reading" controls_uid=uuid focus="modal_title_start_reading" disabled=is_current fallback_url=fallback_url %}
|
|
|
|
|
|
{% elif shelf.identifier == 'read' %}
|
|
|
|
{% trans "Read" as button_text %}
|
|
{% url 'reading-status' 'finish' book.id as fallback_url %}
|
|
{% include 'snippets/toggle/toggle_button.html' with class=button_class text=button_text controls_text="finish_reading" controls_uid=uuid focus="modal_title_finish_reading" disabled=is_current 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=button_class text=button_text controls_text="want_to_read" controls_uid=uuid focus="modal_title_want_to_read" disabled=is_current fallback_url=fallback_url %}
|
|
|
|
{% endif %}
|
|
</li>
|
|
{% endwith %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% if shelf.identifier == 'all' %}
|
|
{% for shelved_in in book.shelves.all %}
|
|
<li class="navbar-divider m-0" role="separator" ></li>
|
|
<li role="menuitem" class="dropdown-item p-0">
|
|
<form name="shelve" action="/unshelve/" method="post">
|
|
{% csrf_token %}
|
|
<input type="hidden" name="book" value="{{ book.id }}">
|
|
<input type="hidden" name="shelf" value="{{ shelved_in.id }}">
|
|
<button class="button is-fullwidth is-small is-radiusless is-danger is-light" type="submit">{% trans "Remove from" %} {{ shelved_in.name }}</button>
|
|
</form>
|
|
</li>
|
|
{% endfor %}
|
|
{% else %}
|
|
<li class="navbar-divider" role="separator" ></li>
|
|
<li role="menuitem" class="dropdown-item p-0">
|
|
<form name="shelve" action="/unshelve/" method="post">
|
|
{% csrf_token %}
|
|
<input type="hidden" name="book" value="{{ book.id }}">
|
|
<input type="hidden" name="shelf" value="{{ shelf.id }}">
|
|
<button class="button is-fullwidth is-small is-radiusless is-danger is-light" type="submit">{% trans "Remove from" %} {{ shelf.name }}</button>
|
|
</form>
|
|
</li>
|
|
{% 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="" %}
|
|
|
|
{% 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="" %}
|
|
|
|
{% 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="" %}
|
|
|
|
{% endwith %}
|
|
{% endblock %}
|