mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 16:40:36 +00:00
Unshelve button on shelf page
This commit is contained in:
parent
bdde69473a
commit
069b4eae2a
3 changed files with 23 additions and 1 deletions
|
@ -66,6 +66,18 @@
|
|||
{% include 'snippets/stars.html' with rating=ratings|dict_key:book.id %}
|
||||
</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-small" type="submit" style="">
|
||||
<span class="icon icon-x">
|
||||
<span class="is-sr-only">Remove from shelf</span>
|
||||
</span>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
|
|
@ -117,6 +117,7 @@ urlpatterns = [
|
|||
re_path(r'^delete-status/?$', actions.delete_status),
|
||||
|
||||
re_path(r'^shelve/?$', actions.shelve),
|
||||
re_path(r'^unshelve/?$', actions.unshelve),
|
||||
|
||||
re_path(r'^follow/?$', actions.follow),
|
||||
re_path(r'^unfollow/?$', actions.unfollow),
|
||||
|
|
|
@ -285,6 +285,16 @@ def shelve(request):
|
|||
return redirect('/')
|
||||
|
||||
|
||||
@login_required
|
||||
def unshelve(request):
|
||||
''' put a on a user's shelf '''
|
||||
book = models.Edition.objects.get(id=request.POST['book'])
|
||||
current_shelf = models.Shelf.objects.get(id=request.POST['shelf'])
|
||||
|
||||
outgoing.handle_unshelve(request.user, book, current_shelf)
|
||||
return redirect(request.headers.get('Referer', '/'))
|
||||
|
||||
|
||||
@login_required
|
||||
def rate(request):
|
||||
''' just a star rating for a book '''
|
||||
|
@ -322,7 +332,6 @@ def reply(request):
|
|||
|
||||
def handle_status(request, form):
|
||||
''' all the "create a status" functions are the same '''
|
||||
book_id = request.POST.get('book')
|
||||
if not form.is_valid():
|
||||
return redirect(request.headers.get('Referer', '/'))
|
||||
|
||||
|
|
Loading…
Reference in a new issue