2020-12-12 21:25:04 -05:00
{% load bookwyrm_tags %}
2020-03-27 11:10:04 -04:00
{% if request.user.is_authenticated %}
2020-02-21 19:26:52 -05:00
2020-11-16 19:34:26 -05:00
{% with book.id|uuid as uuid %}
2020-11-20 13:05:37 -05:00
{% active_shelf book as active_shelf %}
2020-09-28 20:25:26 -04:00
< div class = "field is-grouped" >
2020-12-16 17:45:35 -05:00
{% if switch_mode and active_shelf.book != book %}
{% include 'snippets/switch_edition_button.html' with edition=book size='is-small' %}
{% else %}
2020-12-16 12:15:26 -05:00
{% if active_shelf.shelf.identifier == 'read' %}
2020-11-06 14:55:32 -05:00
< button class = "button is-small" disabled >
< span > Read< / span > < span class = "icon icon-check" > < / span >
< / button >
2020-12-16 12:15:26 -05:00
{% elif active_shelf.shelf.identifier == 'reading' %}
2021-01-17 11:26:28 -05:00
{% include 'snippets/toggle/toggle_button.html' with class="is-small" text="I'm done!" controls_text="finish-reading" controls_uid=uuid %}
2020-12-16 12:15:26 -05:00
{% elif active_shelf.shelf.identifier == 'to-read' %}
2021-01-17 11:26:28 -05:00
{% include 'snippets/toggle/toggle_button.html' with class="is-small" text="Start reading" controls_text="start-reading" controls_uid=uuid %}
2020-11-05 19:48:15 -05:00
{% else %}
< form name = "shelve" action = "/shelve/" method = "post" >
{% csrf_token %}
2020-12-16 12:15:26 -05:00
< input type = "hidden" name = "book" value = "{{ active_shelf.book.id }}" >
2020-11-05 19:48:15 -05:00
< input type = "hidden" name = "shelf" value = "to-read" >
< button class = "button is-small" type = "submit" > Want to read< / button >
< / form >
{% endif %}
2020-11-16 19:34:26 -05:00
< div class = "dropdown" >
2020-11-08 18:15:42 -05:00
< div class = "dropdown-trigger" >
2021-01-14 18:45:30 -05:00
< label for = "shelf-select-dropdown-{{ uuid }}-toggle" role = "button" aria-expanded = "false" class = "pulldown-menu" tabindex = "0" aria-haspopup = "true" aria-controls = "shelf-select-{{ uuid }}" >
2020-11-16 19:34:26 -05:00
< div class = "button is-small" >
< span class = "icon icon-arrow-down" > < span class = "is-sr-only" > More shelves< / span > < / span >
< / div >
< / label >
2020-11-05 19:48:15 -05:00
< / div >
2020-11-16 19:34:26 -05:00
< input type = "checkbox" class = "toggle-control" id = "shelf-select-dropdown-{{ uuid }}-toggle" >
< div class = "dropdown-menu toggle-content hidden" id = "shelf-select-{{ uuid }}" role = "menu" >
2020-11-05 19:48:15 -05:00
< ul class = "dropdown-content" >
2020-11-06 11:51:50 -05:00
{% for shelf in request.user.shelf_set.all %}
2020-11-16 19:34:26 -05:00
< li role = "menuitem" >
2021-01-06 21:17:25 -05:00
{% if active_shelf.shelf.identifier != 'reading' and shelf.identifier == 'reading' %}
2020-11-09 14:16:39 -05:00
< div class = "dropdown-item pt-0 pb-0" >
2021-01-17 13:10:59 -05:00
{% include 'snippets/toggle/toggle_button.html' with class="is-small" text="Start reading" controls_text="start-reading" controls_uid=uuid %}
2020-11-09 14:16:39 -05:00
< / div >
{% else %}
2020-11-06 12:00:33 -05:00
< form class = "dropdown-item pt-0 pb-0" name = "shelve" action = "/shelve/" method = "post" >
2020-11-06 11:51:50 -05:00
{% csrf_token %}
2020-12-16 12:15:26 -05:00
< input type = "hidden" name = "book" value = "{{ active_shelf.book.id }}" >
2020-11-06 14:55:32 -05:00
< button class = "button is-small" name = "shelf" type = "submit" value = "{{ shelf.identifier }}" { % if shelf in book . shelf_set . all % } disabled { % endif % } >
< span > {{ shelf.name }}< / span >
{% if shelf in book.shelf_set.all %}< span class = "icon icon-check" > < / span > {% endif %}
< / button >
2020-11-06 11:51:50 -05:00
< / form >
2020-11-09 14:16:39 -05:00
{% endif %}
2020-11-06 11:51:50 -05:00
< / li >
{% endfor %}
2020-11-05 19:48:15 -05:00
< / ul >
< / div >
2020-09-28 18:57:31 -04:00
< / div >
2020-12-16 17:45:35 -05:00
{% endif %}
2020-11-05 19:48:15 -05:00
< / div >
2021-01-17 13:10:59 -05:00
{% 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 %}
{% include 'snippets/finish_reading_modal.html' with book=active_shelf.book controls_text="finish-reading" controls_uid=uuid readthrough=readthrough %}
2020-11-16 19:34:26 -05:00
{% endwith %}
2020-03-27 11:10:04 -04:00
{% endif %}