html for updated reading progress flow
This commit is contained in:
@ -1,34 +1,137 @@
|
||||
{% load fr_display %}
|
||||
{% if request.user.is_authenticated %}
|
||||
{% with book.id|uuid as uuid %}
|
||||
|
||||
{% active_shelf book as active_shelf %}
|
||||
<div class="field is-grouped">
|
||||
<form name="shelve" action="/shelve/" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="book" value="{{ book.id }}">
|
||||
<input type="hidden" name="shelf" value="{% shelve_button_identifier book %}">
|
||||
<button class="button is-small" type="submit" style="">{% shelve_button_text book %}</button>
|
||||
</form>
|
||||
<div class="dropdown is-hoverable">
|
||||
{% if not hide_pulldown %}
|
||||
<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="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>
|
||||
{% 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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
</form>
|
||||
</div>
|
||||
<label class="modal-close is-large" for="finish-reading-{{ uuid }}" aria-label="close"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
|
Reference in New Issue
Block a user