Cache checking if books are on shelve in shelve button snippet
This commit is contained in:
@ -6,8 +6,9 @@
|
||||
{% with book.id|uuid as uuid %}
|
||||
{% active_shelf book as active_shelf %}
|
||||
{% latest_read_through book request.user as readthrough %}
|
||||
{% with active_shelf_book=active_shelf.book %}
|
||||
<div class="field has-addons mb-0 has-text-weight-normal" data-shelve-button-book="{{ book.id }}">
|
||||
{% if switch_mode and active_shelf.book != book %}
|
||||
{% if switch_mode and active_shelf_book != book %}
|
||||
<div class="control">
|
||||
{% include 'snippets/switch_edition_button.html' with edition=book size='is-small' %}
|
||||
</div>
|
||||
@ -20,16 +21,17 @@
|
||||
</div>
|
||||
|
||||
{% join "want_to_read" uuid as modal_id %}
|
||||
{% include 'snippets/reading_modals/want_to_read_modal.html' with book=active_shelf.book id=modal_id class="" %}
|
||||
{% include 'snippets/reading_modals/want_to_read_modal.html' with book=active_shelf_book id=modal_id class="" %}
|
||||
|
||||
{% join "start_reading" uuid as modal_id %}
|
||||
{% include 'snippets/reading_modals/start_reading_modal.html' with book=active_shelf.book id=modal_id class="" %}
|
||||
{% include 'snippets/reading_modals/start_reading_modal.html' with book=active_shelf_book id=modal_id class="" %}
|
||||
|
||||
{% join "finish_reading" uuid as modal_id %}
|
||||
{% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf.book id=modal_id readthrough=readthrough class="" %}
|
||||
{% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf_book id=modal_id readthrough=readthrough class="" %}
|
||||
|
||||
{% join "progress_update" uuid as modal_id %}
|
||||
{% include 'snippets/reading_modals/progress_update_modal.html' with book=active_shelf.book id=modal_id readthrough=readthrough class="" %}
|
||||
{% include 'snippets/reading_modals/progress_update_modal.html' with book=active_shelf_book id=modal_id readthrough=readthrough class="" %}
|
||||
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
|
@ -38,7 +38,7 @@
|
||||
<form name="shelve-{{ uuid }}-{{ shelf.identifier }}" action="/shelve/" method="post" autocomplete="off">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="book" value="{{ active_shelf.book.id }}">
|
||||
<button class="button {{ class }}" name="shelf" type="submit" value="{{ shelf.identifier }}" {% if shelf in book.shelf_set.all %} disabled {% endif %}>
|
||||
<button class="button {{ class }}" name="shelf" type="submit" value="{{ shelf.identifier }}" {% if book|is_book_on_shelf:shelf %} disabled {% endif %}>
|
||||
<span>{{ shelf.name }}</span>
|
||||
</button>
|
||||
</form>
|
||||
|
@ -45,7 +45,13 @@
|
||||
<form name="shelve-{{ uuid }}-{{ shelf.identifier }}" action="/shelve/" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="book" value="{{ active_shelf.book.id }}">
|
||||
<button class="button {{ class }}" name="shelf" type="submit" value="{{ shelf.identifier }}" {% if shelf in book.shelf_set.all %} disabled {% endif %}>
|
||||
<button
|
||||
class="button {{ class }}"
|
||||
name="shelf"
|
||||
type="submit"
|
||||
value="{{ shelf.identifier }}"
|
||||
{% if book|is_book_on_shelf:shelf %} disabled {% endif %}
|
||||
>
|
||||
<span>{{ shelf.name }}</span>
|
||||
</button>
|
||||
</form>
|
||||
|
Reference in New Issue
Block a user