Switch edition from editions list page

This commit is contained in:
Mouse Reeve 2020-12-16 14:45:35 -08:00
parent 8a1800ea26
commit 21b0bec8d7
3 changed files with 8 additions and 8 deletions

View file

@ -1,16 +1,11 @@
<div class="columns">
<div class="columns is-multiline">
{% for book in books %}
{% if forloop.counter0|divisibleby:"4" %}
</div>
<div class="columns">
{% endif %}
<div class="column is-narrow">
<div class="box">
<a href="/book/{{ book.id }}">
{% include 'snippets/book_cover.html' with book=book %}
</a>
{% include 'snippets/rate_action.html' with user=request.user book=book %}
{% include 'snippets/shelve_button.html' with book=book %}
{% include 'snippets/shelve_button.html' with book=book switch_mode=True %}
</div>
</div>
{% endfor %}

View file

@ -4,6 +4,10 @@
{% with book.id|uuid as uuid %}
{% active_shelf book as active_shelf %}
<div class="field is-grouped">
{% if switch_mode and active_shelf.book != book %}
{% include 'snippets/switch_edition_button.html' with edition=book size='is-small' %}
{% else %}
{% if active_shelf.shelf.identifier == 'read' %}
<button class="button is-small" disabled>
<span>Read</span> <span class="icon icon-check"></span>
@ -62,6 +66,7 @@
</ul>
</div>
</div>
{% endif %}
</div>
{% endwith %}
{% endif %}

View file

@ -1,5 +1,5 @@
<form name="switch-edition" action="/switch-edition" method="POST">
{% csrf_token %}
<input type="hidden" name="edition" value="{{ edition.id }}">
<button class="button">Switch to this edition</button>
<button class="button {{ size }}">Switch to this edition</button>
</form>