From c7863ec8f0ef1375eef8a23907f17a5e279f3f55 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 31 Mar 2021 15:00:49 -0700 Subject: [PATCH 1/2] Fixes re-shelving books from all books view --- bookwyrm/templates/snippets/shelf_selector.html | 2 +- bookwyrm/templates/user/shelf.html | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bookwyrm/templates/snippets/shelf_selector.html b/bookwyrm/templates/snippets/shelf_selector.html index 1bc448ec..edc291e0 100644 --- a/bookwyrm/templates/snippets/shelf_selector.html +++ b/bookwyrm/templates/snippets/shelf_selector.html @@ -12,7 +12,7 @@ diff --git a/bookwyrm/templates/user/shelf.html b/bookwyrm/templates/user/shelf.html index 8d23dce4..d1de6e00 100644 --- a/bookwyrm/templates/user/shelf.html +++ b/bookwyrm/templates/user/shelf.html @@ -111,7 +111,12 @@ {% endif %} {% if shelf.user == request.user %} - {% 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 %} {% endif %} From 210cf4a7024823c1d503897df6afed52e3744be1 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 31 Mar 2021 15:03:07 -0700 Subject: [PATCH 2/2] Fixes shelf redirects --- bookwyrm/views/shelf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bookwyrm/views/shelf.py b/bookwyrm/views/shelf.py index 971eb858..88982b26 100644 --- a/bookwyrm/views/shelf.py +++ b/bookwyrm/views/shelf.py @@ -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