forked from mirrors/bookwyrm
72 lines
3.5 KiB
HTML
72 lines
3.5 KiB
HTML
{% load bookwyrm_tags %}
|
|
{% if request.user.is_authenticated %}
|
|
|
|
{% 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>
|
|
</button>
|
|
{% elif active_shelf.shelf.identifier == 'reading' %}
|
|
<label class="button is-small" for="finish-reading-{{ uuid }}" role="button" tabindex="0">
|
|
I'm done!
|
|
</label>
|
|
{% include 'snippets/finish_reading_modal.html' with book=active_shelf.book %}
|
|
{% elif active_shelf.shelf.identifier == 'to-read' %}
|
|
<label class="button is-small" for="start-reading-{{ uuid }}" role="button" tabindex="0">
|
|
Start reading
|
|
</label>
|
|
{% include 'snippets/start_reading_modal.html' with book=active_shelf.book %}
|
|
{% else %}
|
|
<form name="shelve" action="/shelve/" method="post">
|
|
{% csrf_token %}
|
|
<input type="hidden" name="book" value="{{ active_shelf.book.id }}">
|
|
<input type="hidden" name="shelf" value="to-read">
|
|
<button class="button is-small" type="submit">Want to read</button>
|
|
</form>
|
|
{% endif %}
|
|
|
|
<div class="dropdown">
|
|
<div class="dropdown-trigger">
|
|
<label for="shelf-select-dropdown-{{ uuid }}-toggle" role="button" aria-expanded="false" onclick="toggleMenu(this)" tabindex="0" aria-haspopup="true" aria-controls="shelf-select-{{ uuid }}">
|
|
<div class="button is-small">
|
|
<span class="icon icon-arrow-down"><span class="is-sr-only">More shelves</span></span>
|
|
</div>
|
|
</label>
|
|
</div>
|
|
<input type="checkbox" class="toggle-control" id="shelf-select-dropdown-{{ uuid }}-toggle">
|
|
<div class="dropdown-menu toggle-content hidden" id="shelf-select-{{ uuid }}" role="menu">
|
|
<ul class="dropdown-content">
|
|
{% for shelf in request.user.shelf_set.all %}
|
|
<li role="menuitem">
|
|
{% if active_shelf.shelf.identifier == 'to-read' and shelf.identifier == 'reading' %}
|
|
<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' with book=active_shelf.book %}
|
|
</div>
|
|
{% else %}
|
|
<form class="dropdown-item pt-0 pb-0" name="shelve" action="/shelve/" method="post">
|
|
{% csrf_token %}
|
|
<input type="hidden" name="book" value="{{ active_shelf.book.id }}">
|
|
<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>
|
|
</form>
|
|
{% endif %}
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endwith %}
|
|
{% endif %}
|