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-11-06 00:48:15 +00:00
|
|
|
{% with book.id|uuid as uuid %}
|
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-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' %}
|
|
|
|
<label class="button is-small" for="finish-reading-{{ uuid }}">
|
|
|
|
I'm done!
|
|
|
|
</label>
|
|
|
|
{% elif active_shelf.identifier == 'to-read' %}
|
|
|
|
<label class="button is-small" for="start-reading-{{ uuid }}">
|
|
|
|
Start reading
|
|
|
|
</label>
|
|
|
|
{% 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 %}
|
|
|
|
|
|
|
|
<div class="dropdown is-hoverable">
|
|
|
|
<div class="button dropdown-trigger is-small">
|
|
|
|
<span class="icon icon-arrow-down"><span class="is-sr-only">More shelves</span></span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="dropdown-menu">
|
|
|
|
<ul class="dropdown-content">
|
2020-11-06 16:51:50 +00:00
|
|
|
{% for shelf in request.user.shelf_set.all %}
|
|
|
|
<li>
|
|
|
|
{% if shelf.identifier == 'reading' and active_shelf.identifier != 'reading' %}
|
2020-11-06 17:00:33 +00:00
|
|
|
<div class="dropdown-item pt-0 pb-0">
|
2020-11-06 16:51:50 +00:00
|
|
|
<label class="button is-small" for="start-reading-{{ uuid }}">
|
|
|
|
{{ shelf.name }}
|
|
|
|
</label>
|
|
|
|
</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>
|
|
|
|
{% endif %}
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
2020-11-06 00:48:15 +00:00
|
|
|
</ul>
|
|
|
|
</div>
|
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-11-06 00:48:15 +00:00
|
|
|
<div>
|
|
|
|
<input class="toggle-control" type="checkbox" name="start-reading-{{ uuid }}" id="start-reading-{{ uuid }}">
|
|
|
|
<div class="modal toggle-content hidden">
|
|
|
|
<div class="modal-background"></div>
|
|
|
|
<div class="modal-card">
|
|
|
|
<header class="modal-card-head">
|
2020-11-06 21:03:54 +00:00
|
|
|
<p class="modal-card-title">Start "{{ book.title }}"</p>
|
2020-11-06 00:48:15 +00:00
|
|
|
<label class="delete" for="start-reading-{{ uuid }}" aria-label="close"></label>
|
|
|
|
</header>
|
|
|
|
<form name="start-reading" action="/start-reading" method="post">
|
|
|
|
<section class="modal-card-body">
|
2020-11-06 16:51:50 +00:00
|
|
|
{% csrf_token %}
|
|
|
|
<input type="hidden" name="book" value="{{ book.id }}">
|
|
|
|
<div class="field">
|
2020-11-08 21:40:36 +00:00
|
|
|
<label class="label">
|
2020-11-06 16:51:50 +00:00
|
|
|
Started reading
|
2020-11-07 04:36:52 +00:00
|
|
|
<input type="date" name="start_date" class="input" id="start_id_start_date-{{ uuid }}" value="{% now "Y-m-d" %}">
|
2020-11-06 16:51:50 +00:00
|
|
|
</label>
|
|
|
|
</div>
|
2020-11-06 00:48:15 +00:00
|
|
|
</section>
|
|
|
|
<footer class="modal-card-foot">
|
|
|
|
<div class="columns">
|
2020-11-06 17:07:04 +00:00
|
|
|
<div class="column field">
|
2020-11-06 00:48:15 +00:00
|
|
|
<label for="post-status">
|
|
|
|
<input type="checkbox" name="post-status" class="checkbox" checked>
|
|
|
|
Post to feed
|
|
|
|
</label>
|
2020-11-06 17:07:04 +00:00
|
|
|
{% include 'snippets/privacy_select.html' %}
|
2020-11-06 00:48:15 +00:00
|
|
|
</div>
|
|
|
|
<div class="column">
|
2020-11-06 20:51:49 +00:00
|
|
|
<button class="button is-success" type="submit">Save</button>
|
2020-11-06 16:54:59 +00:00
|
|
|
<label for="start-reading-{{ uuid }}" class="button">Cancel</button>
|
2020-11-06 00:48:15 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</footer>
|
2020-09-28 22:57:31 +00:00
|
|
|
</form>
|
2020-11-06 00:48:15 +00:00
|
|
|
</div>
|
2020-11-06 20:51:49 +00:00
|
|
|
<label class="modal-close is-large" for="start-reading-{{ uuid }}" aria-label="close"></label>
|
2020-09-28 22:57:31 +00:00
|
|
|
</div>
|
2020-04-08 17:04:45 +00:00
|
|
|
</div>
|
2020-02-21 23:39:25 +00:00
|
|
|
|
2020-11-06 00:48:15 +00:00
|
|
|
<div>
|
|
|
|
<input class="toggle-control" type="checkbox" name="finish-reading-{{ uuid }}" id="finish-reading-{{ uuid }}">
|
|
|
|
<div class="modal toggle-content hidden">
|
|
|
|
<div class="modal-background"></div>
|
|
|
|
<div class="modal-card">
|
|
|
|
<header class="modal-card-head">
|
2020-11-06 21:03:54 +00:00
|
|
|
<p class="modal-card-title">Finish "{{ book.title }}"</p>
|
2020-11-06 00:48:15 +00:00
|
|
|
<label class="delete" for="finish-reading-{{ uuid }}" aria-label="close"></label>
|
|
|
|
</header>
|
|
|
|
{% active_read_through book user as readthrough %}
|
|
|
|
<form name="finish-reading" action="/finish-reading" method="post">
|
|
|
|
<section class="modal-card-body">
|
2020-11-06 16:51:50 +00:00
|
|
|
{% csrf_token %}
|
|
|
|
<input type="hidden" name="book" value="{{ book.id }}">
|
|
|
|
<input type="hidden" name="id" value="{{ readthrough.id }}">
|
|
|
|
<div class="field">
|
2020-11-08 21:40:36 +00:00
|
|
|
<label class="label">
|
2020-11-06 16:51:50 +00:00
|
|
|
Started reading
|
2020-11-07 04:36:52 +00:00
|
|
|
<input type="date" name="start_date" class="input" id="finish_id_start_date-{{ uuid }}" value="{{ readthrough.start_date | date:"Y-m-d" }}">
|
2020-11-06 16:51:50 +00:00
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
<div class="field">
|
2020-11-08 21:40:36 +00:00
|
|
|
<label class="label">
|
2020-11-06 16:51:50 +00:00
|
|
|
Finished reading
|
2020-11-07 04:36:52 +00:00
|
|
|
<input type="date" name="finish_date" class="input" id="id_finish_date-{{ uuid }}" value="{% now "Y-m-d" %}">
|
2020-11-06 16:51:50 +00:00
|
|
|
</label>
|
|
|
|
</div>
|
2020-11-06 00:48:15 +00:00
|
|
|
</section>
|
|
|
|
<footer class="modal-card-foot">
|
|
|
|
<div class="columns">
|
2020-11-06 17:07:04 +00:00
|
|
|
<div class="column field">
|
2020-11-06 00:48:15 +00:00
|
|
|
<label for="post-status">
|
|
|
|
<input type="checkbox" name="post-status" class="checkbox" checked>
|
|
|
|
Post to feed
|
|
|
|
</label>
|
2020-11-06 17:07:04 +00:00
|
|
|
{% include 'snippets/privacy_select.html' %}
|
2020-11-06 00:48:15 +00:00
|
|
|
</div>
|
|
|
|
<div class="column">
|
2020-11-06 16:51:50 +00:00
|
|
|
<button type="submit" class="button is-success">Save</button>
|
2020-11-06 16:54:59 +00:00
|
|
|
<label for="finish-reading-{{ uuid }}" class="button">Cancel</button>
|
2020-11-06 00:48:15 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</footer>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<label class="modal-close is-large" for="finish-reading-{{ uuid }}" aria-label="close"></label>
|
|
|
|
</div>
|
2020-09-29 00:25:26 +00:00
|
|
|
</div>
|
2020-11-06 00:48:15 +00:00
|
|
|
{% endwith %}
|
2020-03-27 15:10:04 +00:00
|
|
|
{% endif %}
|