Merge pull request #838 from mouse-reeve/reshelve-fix

Fixes re-shelving books from all books view
This commit is contained in:
Mouse Reeve 2021-03-31 15:18:56 -07:00 committed by GitHub
commit 6e66154e35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View file

@ -12,7 +12,7 @@
<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="change-shelf-from" value={{ current.identifier }}>
<input type="hidden" name="change-shelf-from" value="{{ current.identifier }}">
<input type="hidden" name="shelf" value="{{ shelf.identifier }}">
<button class="button is-fullwidth is-small" type="submit">{{ shelf.name }}</button>
</form>

View file

@ -111,7 +111,12 @@
{% endif %}
{% if shelf.user == request.user %}
<td>
{% include 'snippets/shelf_selector.html' with current=shelf %}
{% if not shelf.id %}
{% active_shelf book as current %}
{% include 'snippets/shelf_selector.html' with current=current.shelf class="is-small" %}
{% else %}
{% include 'snippets/shelf_selector.html' with current=shelf class="is-small" %}
{% endif %}
</td>
{% endif %}
</tr>

View file

@ -102,7 +102,7 @@ def create_shelf(request):
return redirect(request.headers.get("Referer", "/"))
shelf = form.save()
return redirect("/user/%s/shelf/%s" % (request.user.localname, shelf.identifier))
return redirect(shelf.local_path)
@login_required
@ -114,7 +114,7 @@ def delete_shelf(request, shelf_id):
return HttpResponseBadRequest()
shelf.delete()
return redirect("/user/%s/shelves" % request.user.localname)
return redirect("user-shelves", request.user.localname)
@login_required