moviewyrm/fedireads/templates/snippets/shelve_button.html

29 lines
970 B
HTML

{% load fr_display %}
{% if request.user.is_authenticated %}
{% if not pulldown %}
<form name="shelve" action="/shelve/" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="{{ book.id }}"></input>
<input type="hidden" name="shelf" value="{% shelve_button_identifier book %}"></input>
<button class="secondary" type="submit">{% shelve_button_text book %}</button>
</form>
{% else %}
<form name="shelve" action="/shelve/" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="{{ book.id }}"></input>
<select name="shelf">
{% for shelf in request.user.shelf_set.all %}
<option value="{{ shelf.identifier }}" {% if book in shelf.books.all %} selected {% endif %}>
{{ shelf.name }}{% if book in shelf.books.all %} ✓ {% endif %}
</option>
{% endfor %}
</select>
<button class="secondary" type="submit">Shelve</button>
</form>
{% endif %}
{% endif %}