Uses snippet for toggle buttons

This commit is contained in:
Mouse Reeve
2021-01-14 13:02:50 -08:00
parent e57c4f4bcd
commit aa564b26c8
13 changed files with 45 additions and 66 deletions

View File

@ -13,15 +13,9 @@
<span>Read</span> <span class="icon icon-check"></span>
</button>
{% elif active_shelf.shelf.identifier == 'reading' %}
<label class="button is-small" for="finish-reading-{{ uuid }}" role="button" tabindex="0">
I'm done!
</label>
{% include 'snippets/finish_reading_modal.html' with book=active_shelf.book %}
{% include 'snippets/toggle/toggle_button.html' with small=True text="I'm done!" controls_text="finish-reading" controls_uid=uuid %}
{% elif active_shelf.shelf.identifier == 'to-read' %}
<label class="button is-small" for="start-reading-{{ uuid }}" role="button" tabindex="0">
Start reading
</label>
{% include 'snippets/start_reading_modal.html' with book=active_shelf.book %}
{% include 'snippets/toggle/toggle_button.html' with small=True text="Start reading" controls_text="start-reading" controls_uid=uuid %}
{% else %}
<form name="shelve" action="/shelve/" method="post">
{% csrf_token %}
@ -46,9 +40,7 @@
<li role="menuitem">
{% if active_shelf.shelf.identifier != 'reading' and shelf.identifier == 'reading' %}
<div class="dropdown-item pt-0 pb-0">
<label class="button is-small" for="start-reading-{{ uuid }}" role="button" tabindex="0">
Start reading
</label>
{% include 'snippets/toggle/toggle_button.html' with small=True text="Start reading" controls_text="start-reading" controls_uid=uuid %}
</div>
{% else %}
<form class="dropdown-item pt-0 pb-0" name="shelve" action="/shelve/" method="post">
@ -67,5 +59,7 @@
</div>
{% endif %}
</div>
{% include 'snippets/start_reading_modal.html' with book=active_shelf.book %}
{% include 'snippets/finish_reading_modal.html' with book=active_shelf.book %}
{% endwith %}
{% endif %}