Unshelve option in shelve button menu

This commit is contained in:
Mouse Reeve 2021-03-29 12:27:12 -07:00
parent 91b81de8a7
commit 794b47d119
2 changed files with 18 additions and 1 deletions

View file

@ -3,6 +3,7 @@
{% with book.id|uuid as uuid %} {% with book.id|uuid as uuid %}
{% active_shelf book as active_shelf %} {% active_shelf book as active_shelf %}
{% latest_read_through book request.user as readthrough %}
<div class="field has-addons mb-0"> <div class="field has-addons mb-0">
{% if switch_mode and active_shelf.book != book %} {% if switch_mode and active_shelf.book != book %}
<div class="control"> <div class="control">
@ -20,7 +21,6 @@
{% include 'snippets/shelve_button/start_reading_modal.html' with book=active_shelf.book controls_text="start-reading" controls_uid=uuid %} {% include 'snippets/shelve_button/start_reading_modal.html' with book=active_shelf.book controls_text="start-reading" controls_uid=uuid %}
{% latest_read_through book request.user as readthrough %}
{% include 'snippets/shelve_button/finish_reading_modal.html' with book=active_shelf.book controls_text="finish-reading" controls_uid=uuid readthrough=readthrough %} {% include 'snippets/shelve_button/finish_reading_modal.html' with book=active_shelf.book controls_text="finish-reading" controls_uid=uuid readthrough=readthrough %}
{% include 'snippets/shelve_button/progress_update_modal.html' with book=shelf_book.book controls_text="progress-update" controls_uid=uuid readthrough=readthrough %} {% include 'snippets/shelve_button/progress_update_modal.html' with book=shelf_book.book controls_text="progress-update" controls_uid=uuid readthrough=readthrough %}

View file

@ -28,6 +28,8 @@
{% if dropdown %}</li>{% endif %} {% if dropdown %}</li>{% endif %}
{% endfor %} {% endfor %}
{% if dropdown %} {% if dropdown %}
{% if readthrough and active_shelf.shelf.identifier != 'read' %}
<li role="menuitem"> <li role="menuitem">
<div class="dropdown-item pt-0 pb-0"> <div class="dropdown-item pt-0 pb-0">
{% trans "Update progress" as button_text %} {% trans "Update progress" as button_text %}
@ -35,3 +37,18 @@
</div> </div>
</li> </li>
{% endif %} {% endif %}
{% if active_shelf.shelf %}
<li role="menuitem">
<div class="dropdown-item pt-0 pb-0">
<form name="shelve" action="/unshelve/" method="post">
{% 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 is-danger is-light" type="submit">{% trans "Unshelve" %}</button>
</form>
</div>
</li>
{% endif %}
{% endif %}