2020-02-21 23:39:25 +00:00
|
|
|
{% load fr_display %}
|
2020-03-27 15:10:04 +00:00
|
|
|
{% if request.user.is_authenticated %}
|
2020-02-22 00:26:52 +00:00
|
|
|
|
2020-11-06 00:48:15 +00:00
|
|
|
{% active_shelf book as active_shelf %}
|
2020-09-29 00:25:26 +00:00
|
|
|
<div class="field is-grouped">
|
2020-11-09 19:16:39 +00:00
|
|
|
{% with book.id|uuid as uuid %}
|
2020-11-06 00:48:15 +00:00
|
|
|
{% if active_shelf.identifier == 'read' %}
|
2020-11-06 19:55:32 +00:00
|
|
|
<button class="button is-small" disabled>
|
|
|
|
<span>Read</span> <span class="icon icon-check"></span>
|
|
|
|
</button>
|
2020-11-06 00:48:15 +00:00
|
|
|
{% elif active_shelf.identifier == 'reading' %}
|
2020-11-09 00:25:22 +00:00
|
|
|
<label class="button is-small" for="finish-reading-{{ uuid }}" role="button" tabindex="0">
|
2020-11-06 00:48:15 +00:00
|
|
|
I'm done!
|
|
|
|
</label>
|
2020-11-08 23:15:42 +00:00
|
|
|
{% include 'snippets/finish_reading_modal.html' %}
|
2020-11-06 00:48:15 +00:00
|
|
|
{% elif active_shelf.identifier == 'to-read' %}
|
2020-11-09 00:25:22 +00:00
|
|
|
<label class="button is-small" for="start-reading-{{ uuid }}" role="button" tabindex="0">
|
2020-11-06 00:48:15 +00:00
|
|
|
Start reading
|
|
|
|
</label>
|
2020-11-08 23:15:42 +00:00
|
|
|
{% include 'snippets/start_reading_modal.html' %}
|
2020-11-06 00:48:15 +00:00
|
|
|
{% else %}
|
|
|
|
<form name="shelve" action="/shelve/" method="post">
|
|
|
|
{% csrf_token %}
|
|
|
|
<input type="hidden" name="book" value="{{ book.id }}">
|
|
|
|
<input type="hidden" name="shelf" value="to-read">
|
|
|
|
<button class="button is-small" type="submit">Want to read</button>
|
|
|
|
</form>
|
|
|
|
{% endif %}
|
2020-11-09 19:16:39 +00:00
|
|
|
{% endwith %}
|
2020-11-06 00:48:15 +00:00
|
|
|
|
|
|
|
<div class="dropdown is-hoverable">
|
2020-11-08 23:15:42 +00:00
|
|
|
<div class="dropdown-trigger">
|
|
|
|
<button class="button is-small" aria-haspopup="true" aria-controls="dropdown-menu-{{ uuid }}">
|
|
|
|
<span class="icon icon-arrow-down"><span class="is-sr-only">More shelves</span></span>
|
|
|
|
</button>
|
2020-11-06 00:48:15 +00:00
|
|
|
</div>
|
|
|
|
|
2020-11-09 19:16:39 +00:00
|
|
|
{% with book.id|uuid as uuid %}
|
2020-11-08 23:15:42 +00:00
|
|
|
<div class="dropdown-menu" id="dropdown-menu-{{ uuid }}" role="menu">
|
2020-11-06 00:48:15 +00:00
|
|
|
<ul class="dropdown-content">
|
2020-11-06 16:51:50 +00:00
|
|
|
{% for shelf in request.user.shelf_set.all %}
|
|
|
|
<li>
|
2020-11-09 19:16:39 +00:00
|
|
|
{% if shelf.identifier == 'to-read' %}
|
|
|
|
<div class="dropdown-item pt-0 pb-0">
|
|
|
|
<label class="button is-small" for="start-reading-{{ uuid }}" role="button" tabindex="0">
|
|
|
|
Start reading
|
|
|
|
</label>
|
|
|
|
{% include 'snippets/start_reading_modal.html' %}
|
|
|
|
</div>
|
|
|
|
{% else %}
|
2020-11-06 17:00:33 +00:00
|
|
|
<form class="dropdown-item pt-0 pb-0" name="shelve" action="/shelve/" method="post">
|
2020-11-06 16:51:50 +00:00
|
|
|
{% csrf_token %}
|
|
|
|
<input type="hidden" name="book" value="{{ book.id }}">
|
2020-11-06 19:55:32 +00:00
|
|
|
<button class="button is-small" name="shelf" type="submit" value="{{ shelf.identifier }}" {% if shelf in book.shelf_set.all %} disabled {% endif %}>
|
|
|
|
<span>{{ shelf.name }}</span>
|
|
|
|
{% if shelf in book.shelf_set.all %}<span class="icon icon-check"></span>{% endif %}
|
|
|
|
</button>
|
2020-11-06 16:51:50 +00:00
|
|
|
</form>
|
2020-11-09 19:16:39 +00:00
|
|
|
{% endif %}
|
2020-11-06 16:51:50 +00:00
|
|
|
</li>
|
|
|
|
{% endfor %}
|
2020-11-06 00:48:15 +00:00
|
|
|
</ul>
|
|
|
|
</div>
|
2020-11-09 19:16:39 +00:00
|
|
|
{% endwith %}
|
2020-09-28 22:57:31 +00:00
|
|
|
</div>
|
2020-11-06 00:48:15 +00:00
|
|
|
</div>
|
2020-09-28 22:57:31 +00:00
|
|
|
|
2020-03-27 15:10:04 +00:00
|
|
|
{% endif %}
|