Merge pull request #301 from mouse-reeve/shelf-controls

Pulldown for moving books between or off shelves
This commit is contained in:
Mouse Reeve 2020-11-07 11:55:55 -08:00 committed by GitHub
commit 5a842ca6ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 10 deletions

View file

@ -67,16 +67,7 @@
</td>
{% endif %}
<td>
<form name="unshelve" action="/unshelve/" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="{{ book.id }}">
<input type="hidden" name="shelf" value="{{ shelf.id }}">
<button class="button is-danger is-small" type="submit" style="">
<span class="icon icon-x">
<span class="is-sr-only">Remove from shelf</span>
</span>
</button>
</form>
{% include 'snippets/shelf_selector.html' with current=shelf %}
</td>
</tr>
{% endfor %}

View file

@ -0,0 +1,31 @@
<div class="dropdown is-hoverable">
<div class="dropdown-trigger button">
<p>Change shelf</p>
<span class="icon icon-arrow-down"></span>
</div>
<div class="dropdown-menu">
<ul class="dropdown-content">
{% for shelf in request.user.shelf_set.all %}
{% if shelf.identifier != current.identifier %}
<li>
<form class="dropdown-item pt-0 pb-0" name="shelve" action="/shelve/" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="{{ book.id }}">
<input type="hidden" name="shelf" value="{{ shelf.identifier }}">
<button class="button is-small" type="submit">{{ shelf.name }}</button>
</form>
</li>
{% endif %}
{% endfor %}
<hr class="navbar-divider">
<li>
<form class="dropdown-item pt-0 pb-0" name="shelve" action="/unshelve/" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="{{ book.id }}">
<input type="hidden" name="shelf" value="{{ current.id }}">
<button class="button is-small is-danger" type="submit">Unshelve</button>
</form>
</li>
</ul>
</div>
</div>