forked from mirrors/bookwyrm
2e944bceb9
The "for" value pointed to an ID for an input that didn't exist, which caused screenreaders to not read the value of the label when specififying readthrough dates. Removing the 'for' tags makes the screenreader read the label as expected since the label wraps the input, so we don't need a 'for'.
150 lines
6.9 KiB
HTML
150 lines
6.9 KiB
HTML
{% 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">
|
|
{% if active_shelf.identifier == 'read' %}
|
|
<button class="button is-small" disabled>
|
|
<span>Read</span> <span class="icon icon-check"></span>
|
|
</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">
|
|
{% for shelf in request.user.shelf_set.all %}
|
|
<li>
|
|
{% if shelf.identifier == 'reading' and active_shelf.identifier != 'reading' %}
|
|
<div class="dropdown-item pt-0 pb-0">
|
|
<label class="button is-small" for="start-reading-{{ uuid }}">
|
|
{{ shelf.name }}
|
|
</label>
|
|
</div>
|
|
{% else %}
|
|
<form class="dropdown-item pt-0 pb-0" name="shelve" action="/shelve/" method="post">
|
|
{% csrf_token %}
|
|
<input type="hidden" name="book" value="{{ 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>
|
|
</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">Start "{{ 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 %}
|
|
<input type="hidden" name="book" value="{{ book.id }}">
|
|
<div class="field">
|
|
<label class="label">
|
|
Started reading
|
|
<input type="date" name="start_date" class="input" id="start_id_start_date-{{ uuid }}" value="{% now "Y-m-d" %}">
|
|
</label>
|
|
</div>
|
|
</section>
|
|
<footer class="modal-card-foot">
|
|
<div class="columns">
|
|
<div class="column field">
|
|
<label for="post-status">
|
|
<input type="checkbox" name="post-status" class="checkbox" checked>
|
|
Post to feed
|
|
</label>
|
|
{% include 'snippets/privacy_select.html' %}
|
|
</div>
|
|
<div class="column">
|
|
<button class="button is-success" type="submit">Save</button>
|
|
<label for="start-reading-{{ uuid }}" class="button">Cancel</button>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
</form>
|
|
</div>
|
|
<label class="modal-close is-large" for="start-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">Finish "{{ 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="book" value="{{ book.id }}">
|
|
<input type="hidden" name="id" value="{{ readthrough.id }}">
|
|
<div class="field">
|
|
<label class="label">
|
|
Started reading
|
|
<input type="date" name="start_date" class="input" id="finish_id_start_date-{{ uuid }}" value="{{ readthrough.start_date | date:"Y-m-d" }}">
|
|
</label>
|
|
</div>
|
|
<div class="field">
|
|
<label class="label">
|
|
Finished reading
|
|
<input type="date" name="finish_date" class="input" id="id_finish_date-{{ uuid }}" value="{% now "Y-m-d" %}">
|
|
</label>
|
|
</div>
|
|
</section>
|
|
<footer class="modal-card-foot">
|
|
<div class="columns">
|
|
<div class="column field">
|
|
<label for="post-status">
|
|
<input type="checkbox" name="post-status" class="checkbox" checked>
|
|
Post to feed
|
|
</label>
|
|
{% include 'snippets/privacy_select.html' %}
|
|
</div>
|
|
<div class="column">
|
|
<button type="submit" class="button is-success">Save</button>
|
|
<label for="finish-reading-{{ uuid }}" 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 %}
|