Handle stopped reading special case in javascript

This should be refactored, but maybe not today
This commit is contained in:
Mouse Reeve 2022-05-26 12:23:13 -07:00
parent 4c5d2570ab
commit 4905652e22
3 changed files with 12 additions and 3 deletions

View file

@ -203,6 +203,7 @@ let StatusCache = new (class {
.forEach((item) => (item.disabled = false)); .forEach((item) => (item.disabled = false));
next_identifier = next_identifier == "complete" ? "read" : next_identifier; next_identifier = next_identifier == "complete" ? "read" : next_identifier;
next_identifier = next_identifier == "stopped-reading-complete" ? "stopped-reading" : next_identifier;
// Disable the current state // Disable the current state
button.querySelector( button.querySelector(

View file

@ -14,8 +14,8 @@
</div> </div>
<div <div
class="{% if next_shelf_identifier != 'stopped-reading' %}is-hidden{% endif %}" class="{% if next_shelf_identifier != 'stopped-reading-complete' %}is-hidden{% endif %}"
data-shelf-identifier="stopped-reading" data-shelf-identifier="stopped-reading-complete"
> >
<button type="button" class="button {{ class }}" disabled> <button type="button" class="button {{ class }}" disabled>
<span>{% trans "Stopped reading" %}</span> <span>{% trans "Stopped reading" %}</span>
@ -42,6 +42,14 @@
{% join "finish_reading" button_uuid as modal_id %} {% join "finish_reading" button_uuid as modal_id %}
{% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %} {% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %}
{% elif shelf.identifier == 'stopped-reading' %}
{% trans "Stop reading" as button_text %}
{% url 'reading-status' 'finish' book.id as fallback_url %}
{% join "stop_reading" button_uuid as modal_id %}
{% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %}
{% elif shelf.identifier == 'to-read' %} {% elif shelf.identifier == 'to-read' %}
{% trans "Want to read" as button_text %} {% trans "Want to read" as button_text %}

View file

@ -31,7 +31,7 @@ def get_next_shelf(current_shelf):
if current_shelf == "read": if current_shelf == "read":
return "complete" return "complete"
if current_shelf == "stopped-reading": if current_shelf == "stopped-reading":
return "stopped-reading" return "stopped-reading-complete"
return "to-read" return "to-read"