forked from mirrors/bookwyrm
Confirmation modal for to-read shelve action
This commit is contained in:
parent
37710144fa
commit
e5fd14b206
5 changed files with 43 additions and 3 deletions
|
@ -8,15 +8,17 @@
|
||||||
{% include 'snippets/toggle/toggle_button.html' with label="close" class="delete" nonbutton=True %}
|
{% include 'snippets/toggle/toggle_button.html' with label="close" class="delete" nonbutton=True %}
|
||||||
</header>
|
</header>
|
||||||
{% block modal-form-open %}{% endblock %}
|
{% block modal-form-open %}{% endblock %}
|
||||||
|
{% if not no_body %}
|
||||||
<section class="modal-card-body">
|
<section class="modal-card-body">
|
||||||
{% block modal-body %}{% endblock %}
|
{% block modal-body %}{% endblock %}
|
||||||
</section>
|
</section>
|
||||||
|
{% endif %}
|
||||||
<footer class="modal-card-foot">
|
<footer class="modal-card-foot">
|
||||||
{% block modal-footer %}{% endblock %}
|
{% block modal-footer %}{% endblock %}
|
||||||
</footer>
|
</footer>
|
||||||
{% block modal-form-close %}{% endblock %}
|
{% block modal-form-close %}{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
<label class="modal-close is-large" for="{{ controls_text }}-{{ readthrough.id }}" aria-label="close"></label>
|
<label class="modal-close is-large" for="{{ controls_text }}-{{ controls_uid }}" aria-label="close"></label>
|
||||||
{% include 'snippets/toggle/toggle_button.html' with label="close" class="modal-close is-large" nonbutton=True %}
|
{% include 'snippets/toggle/toggle_button.html' with label="close" class="modal-close is-large" nonbutton=True %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,14 @@
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="control">
|
<div class="control">
|
||||||
{% include 'snippets/shelve_button_options.html' with class="shelf-option is-small" shelves=request.user.shelf_set.all active_shelf=active_shelf %}
|
{% include 'snippets/shelve_button_options.html' with class="shelf-option is-small" shelves=request.user.shelf_set.all active_shelf=active_shelf button_uuid=uuid %}
|
||||||
</div>
|
</div>
|
||||||
{% include 'snippets/shelve_button_dropdown.html' with class="is-small" button_uuid=uuid%}
|
{% include 'snippets/shelve_button_dropdown.html' with class="is-small" button_uuid=uuid%}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% include 'snippets/want_to_read_modal.html' with book=active_shelf.book controls_text="want-to-read" controls_uid=uuid no_body=True %}
|
||||||
|
|
||||||
{% include 'snippets/start_reading_modal.html' with book=active_shelf.book controls_text="start-reading" controls_uid=uuid %}
|
{% include 'snippets/start_reading_modal.html' with book=active_shelf.book controls_text="start-reading" controls_uid=uuid %}
|
||||||
|
|
||||||
{% latest_read_through book request.user as readthrough %}
|
{% latest_read_through book request.user as readthrough %}
|
||||||
|
|
|
@ -5,10 +5,12 @@
|
||||||
<div class="{% if dropdown %}dropdown-item pt-0 pb-0{% elif active_shelf.shelf.identifier|next_shelf != shelf.identifier %}hidden{% endif %}">
|
<div class="{% if dropdown %}dropdown-item pt-0 pb-0{% elif active_shelf.shelf.identifier|next_shelf != shelf.identifier %}hidden{% endif %}">
|
||||||
{% if shelf.identifier == 'reading' %}
|
{% if shelf.identifier == 'reading' %}
|
||||||
{% include 'snippets/toggle/toggle_button.html' with class=class text="Start reading" controls_text="start-reading" controls_uid=button_uuid focus="modal-title-start-reading" disabled=is_current %}
|
{% include 'snippets/toggle/toggle_button.html' with class=class text="Start reading" controls_text="start-reading" controls_uid=button_uuid focus="modal-title-start-reading" disabled=is_current %}
|
||||||
|
{% elif shelf.identifier == 'read' and active_shelf.shelf.identifier == 'read' %}
|
||||||
|
<button type="button" class="button {{ class }}" disabled><span>Read</span>
|
||||||
{% elif shelf.identifier == 'read' %}
|
{% elif shelf.identifier == 'read' %}
|
||||||
{% include 'snippets/toggle/toggle_button.html' with class=class text="Finish reading" controls_text="finish-reading" controls_uid=button_uuid focus="modal-title-finish-reading" disabled=is_current %}
|
{% include 'snippets/toggle/toggle_button.html' with class=class text="Finish reading" controls_text="finish-reading" controls_uid=button_uuid focus="modal-title-finish-reading" disabled=is_current %}
|
||||||
{% elif shelf.identifier == 'to-read' %}
|
{% elif shelf.identifier == 'to-read' %}
|
||||||
{% include 'snippets/toggle/toggle_button.html' with class=class text="Want to read" controls_text="finish-reading" controls_uid=button_uuid focus="modal-title-finish-reading" disabled=is_current %}
|
{% include 'snippets/toggle/toggle_button.html' with class=class text="Want to read" controls_text="want-to-read" controls_uid=button_uuid focus="modal-title-want-to-read" disabled=is_current %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<form name="shelve" action="/shelve/" method="post">
|
<form name="shelve" action="/shelve/" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
30
bookwyrm/templates/snippets/want_to_read_modal.html
Normal file
30
bookwyrm/templates/snippets/want_to_read_modal.html
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{% extends 'components/modal.html' %}
|
||||||
|
|
||||||
|
{% block modal-title %}
|
||||||
|
Want to Read "<em>{{ book.title }}</em>"
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block modal-form-open %}
|
||||||
|
<form name="shelve" action="/shelve/" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<input type="hidden" name="book" value="{{ active_shelf.book.id }}">
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block modal-footer %}
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column field">
|
||||||
|
<label for="post_status_want-{{ uuid }}">
|
||||||
|
<input type="checkbox" name="post-status" class="checkbox" id="post_status_want-{{ uuid }}" checked>
|
||||||
|
Post to feed
|
||||||
|
</label>
|
||||||
|
{% include 'snippets/privacy_select.html' %}
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<button class="button is-success" name="shelf" type="submit" value="{{ shelf.identifier }}" {% if shelf in book.shelf_set.all %} disabled {% endif %}>
|
||||||
|
<span>Want to read</span>
|
||||||
|
</button>
|
||||||
|
{% include 'snippets/toggle/toggle_button.html' with text="Cancel" controls_text="want-to-read" controls_uid=uuid %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
{% block modal-form-close %}</form>{% endblock %}
|
|
@ -161,10 +161,13 @@ def get_status_preview_name(obj):
|
||||||
|
|
||||||
@register.filter(name='next_shelf')
|
@register.filter(name='next_shelf')
|
||||||
def get_next_shelf(current_shelf):
|
def get_next_shelf(current_shelf):
|
||||||
|
''' shelf you'd use to update reading progress '''
|
||||||
if current_shelf == 'to-read':
|
if current_shelf == 'to-read':
|
||||||
return 'reading'
|
return 'reading'
|
||||||
if current_shelf == 'reading':
|
if current_shelf == 'reading':
|
||||||
return 'read'
|
return 'read'
|
||||||
|
if current_shelf == 'read':
|
||||||
|
return 'read'
|
||||||
return 'to-read'
|
return 'to-read'
|
||||||
|
|
||||||
@register.simple_tag(takes_context=False)
|
@register.simple_tag(takes_context=False)
|
||||||
|
@ -211,4 +214,5 @@ def active_read_through(book, user):
|
||||||
|
|
||||||
@register.simple_tag(takes_context=False)
|
@register.simple_tag(takes_context=False)
|
||||||
def comparison_bool(str1, str2):
|
def comparison_bool(str1, str2):
|
||||||
|
''' idk why I need to write a tag for this, it reutrns a bool '''
|
||||||
return str1 == str2
|
return str1 == str2
|
||||||
|
|
Loading…
Reference in a new issue