diff --git a/bookwyrm/static/js/status_cache.js b/bookwyrm/static/js/status_cache.js
index 2a50bfcb..c59e23ee 100644
--- a/bookwyrm/static/js/status_cache.js
+++ b/bookwyrm/static/js/status_cache.js
@@ -90,6 +90,11 @@ let StatusCache = new class {
trigger.removeAttribute('disabled');
})
.then(response => {
+ if (response.headers.get("forceReload")) {
+ BookWyrm.addRemoveClass(form, 'is-processing', true);
+ trigger.setAttribute('disabled', null);
+ return location.reload();
+ }
if (!response.ok) {
throw new Error();
}
diff --git a/bookwyrm/templates/book/book.html b/bookwyrm/templates/book/book.html
index 936212be..c8c50978 100644
--- a/bookwyrm/templates/book/book.html
+++ b/bookwyrm/templates/book/book.html
@@ -161,13 +161,9 @@
{% for shelf in user_shelfbooks %}
{% blocktrans with path=shelf.shelf.local_path shelf_name=shelf.shelf.name %}{{ shelf_name }}{% endblocktrans %}
- {% if shelf.shelf.editable %}
{% include 'snippets/shelf_selector.html' with current=shelf.shelf class="is-small" %}
- {% else %}
- {% include 'snippets/shelve_button/shelve_button.html' %}
- {% endif %}
{% endfor %}
diff --git a/bookwyrm/templates/snippets/reading_modals/finish_reading_modal.html b/bookwyrm/templates/snippets/reading_modals/finish_reading_modal.html
index 3c127160..79542b29 100644
--- a/bookwyrm/templates/snippets/reading_modals/finish_reading_modal.html
+++ b/bookwyrm/templates/snippets/reading_modals/finish_reading_modal.html
@@ -13,6 +13,7 @@ Finish "{{ book_title }}"
{% csrf_token %}
+
{% endblock %}
{% block reading-dates %}
diff --git a/bookwyrm/templates/snippets/reading_modals/start_reading_modal.html b/bookwyrm/templates/snippets/reading_modals/start_reading_modal.html
index cd0b64f3..03ebd900 100644
--- a/bookwyrm/templates/snippets/reading_modals/start_reading_modal.html
+++ b/bookwyrm/templates/snippets/reading_modals/start_reading_modal.html
@@ -11,6 +11,7 @@ Start "{{ book_title }}"
{% block modal-form-open %}
+
+{% include 'snippets/reading_modals/want_to_read_modal.html' with book=active_shelf.book controls_text="want_to_read" controls_uid=uuid move_from=current.id %}
+
+{% include 'snippets/reading_modals/start_reading_modal.html' with book=active_shelf.book controls_text="start_reading" controls_uid=uuid move_from=current.id %}
+
+{% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf.book controls_text="finish_reading" controls_uid=uuid move_from=current.id readthrough=readthrough %}
+
+{% include 'snippets/reading_modals/progress_update_modal.html' with book=active_shelf.book controls_text="progress_update" controls_uid=uuid move_from=current.id readthrough=readthrough %}
+
+{% endwith %}
{% endblock %}
diff --git a/bookwyrm/views/reading.py b/bookwyrm/views/reading.py
index 54427ffb..a96ccbc0 100644
--- a/bookwyrm/views/reading.py
+++ b/bookwyrm/views/reading.py
@@ -9,6 +9,7 @@ from django.views import View
from django.views.decorators.http import require_POST
from bookwyrm import models
+from bookwyrm.views.shelf.shelf_actions import unshelve
from .status import CreateStatus
from .helpers import get_edition, handle_reading_status, is_api_request
from .helpers import load_date_in_user_tz_as_utc
@@ -85,12 +86,20 @@ class ReadingStatus(View):
if request.POST.get("post-status"):
# is it a comment?
if request.POST.get("content"):
+ # BUG: there is a problem posting statuses for finishing
+ # check whether it existed before.
return CreateStatus.as_view()(request, "comment")
privacy = request.POST.get("privacy")
handle_reading_status(request.user, desired_shelf, book, privacy)
+ if bool(request.POST.get("shelf")):
+ if current_status_shelfbook is None:
+ return unshelve(request, referer=referer, book_id=book_id)
+ return HttpResponse(headers={"forceReload" : "true"})
+
if is_api_request(request):
return HttpResponse()
+
return redirect(referer)
diff --git a/bookwyrm/views/shelf/shelf_actions.py b/bookwyrm/views/shelf/shelf_actions.py
index 702b72c1..8240055e 100644
--- a/bookwyrm/views/shelf/shelf_actions.py
+++ b/bookwyrm/views/shelf/shelf_actions.py
@@ -1,6 +1,7 @@
""" shelf views """
from django.db import IntegrityError, transaction
from django.contrib.auth.decorators import login_required
+from django.http.response import HttpResponse
from django.shortcuts import get_object_or_404, redirect
from django.views.decorators.http import require_POST
@@ -91,13 +92,15 @@ def shelve(request):
@login_required
@require_POST
-def unshelve(request):
+def unshelve(request, referer=None, book_id=False):
"""remove a book from a user's shelf"""
- book = get_object_or_404(models.Edition, id=request.POST.get("book"))
+ id = book_id if book_id else request.POST.get("book")
+ book = get_object_or_404(models.Edition, id=id)
shelf_book = get_object_or_404(
models.ShelfBook, book=book, shelf__id=request.POST["shelf"]
)
shelf_book.raise_not_deletable(request.user)
-
shelf_book.delete()
+ if bool(referer):
+ return HttpResponse(headers={"forceReload" : "true"})
return redirect(request.headers.get("Referer", "/"))