moviewyrm/bookwyrm/templates/snippets/shelve_button.html

138 lines
6.3 KiB
HTML
Raw Normal View History

2020-02-21 23:39:25 +00:00
{% load fr_display %}
{% if request.user.is_authenticated %}
2020-11-06 00:48:15 +00:00
{% with book.id|uuid as uuid %}
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' %}
<button class="button is-small" disabled>Read ✓</button>
{% 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">
<form class="dropdown-item" name="shelve" action="/shelve/" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="{{ book.id }}">
{% for shelf in request.user.shelf_set.all %}
<li>
<button class="button is-small" name="shelf" type="submit" value="{{ shelf.identifier }}" {% if shelf in book.shelf_set.all %} disabled {% endif %}>{{ shelf.name }} {% if shelf in book.shelf_set.all %} ✓ {% endif %}</button>
</li>
{% endfor %}
</form>
</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">
<p class="modal-card-title">Reading "{{ book.title }}"</p>
<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">
{% csrf_token %}
<div class="field">
<label class="label" for="start_date">
Started reading
<input type="date" name="start_date" class="input" id="id_start_date-{{ uuid }}" value="{% now "Y-m-d" %}">
</label>
</div>
</form>
</section>
<footer class="modal-card-foot">
<div class="columns">
<div class="column field is-grouped">
{% include 'snippets/privacy_select.html' %}
<label for="post-status">
<input type="checkbox" name="post-status" class="checkbox" checked>
Post to feed
</label>
</div>
<div class="column">
<button class="button is-success">Save</button>
<button class="button">Cancel</button>
</div>
</div>
</footer>
2020-09-28 22:57:31 +00:00
</form>
2020-11-06 00:48:15 +00:00
</div>
<label class="modal-close is-large" for="finish-reading-{{ uuid }}" aria-label="close"></label>
2020-09-28 22:57:31 +00:00
</div>
</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">
<p class="modal-card-title">Finished "{{ book.title }}"</p>
<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">
{% csrf_token %}
<input type="hidden" name="id" value="{{ readthrough.id }}">
<div class="field">
<label class="label" for="start_date">
Started reading
<input type="date" name="start_date" class="input" id="id_start_date-{{ readthrough.id }}" value="{{ readthrough.start_date | date:"Y-m-d" }}">
</label>
</div>
<div class="field">
<label class="label" for="finish_date">
Finished reading
<input type="date" name="finish_date" class="input" id="id_finish_date-{{ readthrough.id }}" value="{% now "Y-m-d" %}">
</label>
</div>
</form>
</section>
<footer class="modal-card-foot">
<div class="columns">
<div class="column field is-grouped">
{% include 'snippets/privacy_select.html' %}
<label for="post-status">
<input type="checkbox" name="post-status" class="checkbox" checked>
Post to feed
</label>
</div>
<div class="column">
<button class="button is-success">Save</button>
<button class="button">Cancel</button>
</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 %}
{% endif %}