moviewyrm/fedireads/templates/snippets/shelve-button.html
2020-02-21 16:26:52 -08:00

27 lines
883 B
HTML

{% load fr_display %}
{% 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 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 type="submit">Shelve</button>
</form>
{% endif %}