bookwyrm/fedireads/templates/snippets/shelve_button.html
2020-03-16 17:45:56 -07:00

27 lines
919 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 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 %}