2021-01-29 11:51:36 -05:00
|
|
|
{% extends 'components/dropdown.html' %}
|
2022-01-18 14:20:27 -05:00
|
|
|
{% load shelf_tags %}
|
2021-11-19 16:06:13 -05:00
|
|
|
{% load utilities %}
|
2022-01-18 14:20:27 -05:00
|
|
|
{% load i18n %}
|
2021-11-15 04:59:22 -05:00
|
|
|
|
2021-01-17 14:09:49 -05:00
|
|
|
{% block dropdown-trigger %}
|
2021-03-31 12:22:23 -04:00
|
|
|
<span>{% trans "Move book" %}</span>
|
2021-01-17 14:09:49 -05:00
|
|
|
<span class="icon icon-arrow-down" aria-hidden="true"></span>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block dropdown-list %}
|
2021-11-19 16:06:13 -05:00
|
|
|
{% with book.id|uuid as uuid %}
|
|
|
|
{% active_shelf book as active_shelf %}
|
2021-11-19 18:29:17 -05:00
|
|
|
{% latest_read_through book request.user as readthrough %}
|
|
|
|
|
2021-05-22 20:58:08 -04:00
|
|
|
{% for shelf in user_shelves %}
|
2021-11-19 16:06:13 -05:00
|
|
|
|
2021-11-16 03:26:49 -05:00
|
|
|
{% if shelf.editable %}
|
2021-04-21 13:35:50 -04:00
|
|
|
<li role="menuitem" class="dropdown-item p-0">
|
2022-01-20 17:03:38 -05:00
|
|
|
<form name="editable-shelve-{{ uuid }}" action="/shelve/" method="post">
|
2021-01-17 14:09:49 -05:00
|
|
|
{% csrf_token %}
|
|
|
|
<input type="hidden" name="book" value="{{ book.id }}">
|
2021-03-31 18:00:49 -04:00
|
|
|
<input type="hidden" name="change-shelf-from" value="{{ current.identifier }}">
|
2021-01-17 14:09:49 -05:00
|
|
|
<input type="hidden" name="shelf" value="{{ shelf.identifier }}">
|
2021-12-02 15:25:19 -05:00
|
|
|
|
2022-02-19 19:34:17 -05:00
|
|
|
<button class="button is-fullwidth is-small shelf-option is-radiusless has-background-body" type="submit" {% if shelf.identifier == current.identifier %}disabled{% endif %}>
|
2021-12-01 04:07:52 -05:00
|
|
|
<span>
|
2022-01-11 15:10:30 -05:00
|
|
|
{% include "snippets/translated_shelf_name.html" with shelf=shelf %}
|
2021-12-01 04:07:52 -05:00
|
|
|
</span>
|
|
|
|
</button>
|
2021-01-17 14:09:49 -05:00
|
|
|
</form>
|
|
|
|
</li>
|
2021-11-19 16:06:13 -05:00
|
|
|
{% else%}
|
2021-11-19 16:18:43 -05:00
|
|
|
{% comparison_bool shelf.identifier active_shelf.shelf.identifier as is_current %}
|
2022-02-19 19:34:17 -05:00
|
|
|
{% with button_class="is-fullwidth is-small shelf-option is-radiusless has-background-body" %}
|
2021-11-19 16:06:13 -05:00
|
|
|
<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 %}
|
2022-01-11 16:10:25 -05:00
|
|
|
{% join "start_reading" uuid as modal_id %}
|
|
|
|
{% include 'snippets/shelve_button/modal_button.html' with class=button_class fallback_url=fallback_url %}
|
2021-11-19 16:06:13 -05:00
|
|
|
|
|
|
|
|
|
|
|
{% elif shelf.identifier == 'read' %}
|
|
|
|
|
|
|
|
{% trans "Read" as button_text %}
|
|
|
|
{% url 'reading-status' 'finish' book.id as fallback_url %}
|
2022-01-11 16:10:25 -05:00
|
|
|
{% join "finish_reading" uuid as modal_id %}
|
|
|
|
{% include 'snippets/shelve_button/modal_button.html' with class=button_class fallback_url=fallback_url %}
|
2021-11-19 16:06:13 -05:00
|
|
|
|
|
|
|
{% elif shelf.identifier == 'to-read' %}
|
|
|
|
|
|
|
|
{% trans "Want to read" as button_text %}
|
|
|
|
{% url 'reading-status' 'want' book.id as fallback_url %}
|
2022-01-11 16:10:25 -05:00
|
|
|
{% join "want_to_read" uuid as modal_id %}
|
|
|
|
{% include 'snippets/shelve_button/modal_button.html' with class=button_class fallback_url=fallback_url %}
|
2021-11-19 16:06:13 -05:00
|
|
|
|
|
|
|
{% endif %}
|
|
|
|
</li>
|
|
|
|
{% endwith %}
|
2021-11-15 04:59:22 -05:00
|
|
|
{% endif %}
|
2021-01-17 14:09:49 -05:00
|
|
|
{% endfor %}
|
2021-11-24 15:38:08 -05:00
|
|
|
|
|
|
|
{% if shelf.identifier == 'all' %}
|
2022-01-01 21:09:40 -05:00
|
|
|
{% for user_shelf in user_shelves %}
|
|
|
|
{% if user_shelf in book.shelves.all %}
|
2021-11-24 15:38:08 -05:00
|
|
|
<li class="navbar-divider m-0" role="separator" ></li>
|
2021-04-21 13:35:50 -04:00
|
|
|
<li role="menuitem" class="dropdown-item p-0">
|
2022-01-20 17:03:38 -05:00
|
|
|
<form name="shelve-{{ user_shelf.identifier }}-{{ book.id }}-{{ uuid }}" action="/unshelve/" method="post">
|
2021-01-17 14:09:49 -05:00
|
|
|
{% csrf_token %}
|
|
|
|
<input type="hidden" name="book" value="{{ book.id }}">
|
2022-01-01 21:09:40 -05:00
|
|
|
<input type="hidden" name="shelf" value="{{ user_shelf.id }}">
|
|
|
|
<button class="button is-fullwidth is-small is-radiusless is-danger is-light" type="submit">{% trans "Remove from" %} {{ user_shelf.name }}</button>
|
2021-01-17 14:09:49 -05:00
|
|
|
</form>
|
|
|
|
</li>
|
2022-01-01 21:09:40 -05:00
|
|
|
{% endif %}
|
2021-11-24 15:38:08 -05:00
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
|
|
|
<li class="navbar-divider" role="separator" ></li>
|
2021-04-21 13:35:50 -04:00
|
|
|
<li role="menuitem" class="dropdown-item p-0">
|
2022-01-20 17:03:38 -05:00
|
|
|
<form name="un-shelve-{{ shelf.identifier }}-{{ book.id }}-{{ uuid }}" action="/unshelve/" method="post">
|
2021-01-17 14:09:49 -05:00
|
|
|
{% csrf_token %}
|
|
|
|
<input type="hidden" name="book" value="{{ book.id }}">
|
2021-11-24 15:38:08 -05:00
|
|
|
<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>
|
2021-01-17 14:09:49 -05:00
|
|
|
</form>
|
|
|
|
</li>
|
2021-11-24 15:38:08 -05:00
|
|
|
{% endif %}
|
2021-11-19 16:06:13 -05:00
|
|
|
|
2021-12-30 21:06:33 -05:00
|
|
|
{% join "want_to_read" uuid as modal_id %}
|
|
|
|
{% include 'snippets/reading_modals/want_to_read_modal.html' with book=active_shelf.book id=modal_id move_from=current.id refresh=True class="" %}
|
2021-11-19 16:06:13 -05:00
|
|
|
|
2021-12-30 21:06:33 -05:00
|
|
|
{% join "start_reading" uuid as modal_id %}
|
|
|
|
{% include 'snippets/reading_modals/start_reading_modal.html' with book=active_shelf.book id=modal_id move_from=current.id refresh=True class="" %}
|
2021-11-19 16:06:13 -05:00
|
|
|
|
2021-12-30 21:06:33 -05:00
|
|
|
{% join "finish_reading" uuid as modal_id %}
|
2022-01-11 16:10:25 -05:00
|
|
|
{% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf.book id=modal_id move_from=current.id readthrough=readthrough refresh=True class="" %}
|
2021-11-19 16:06:13 -05:00
|
|
|
|
|
|
|
{% endwith %}
|
2021-01-17 14:09:49 -05:00
|
|
|
{% endblock %}
|