mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-26 01:50:34 +00:00
check shelf.editable instead of custom filter
This commit is contained in:
parent
eab2ec0ffd
commit
ec39346e67
3 changed files with 6 additions and 17 deletions
|
@ -161,12 +161,12 @@
|
|||
{% for shelf in user_shelfbooks %}
|
||||
<li class="box">
|
||||
{% blocktrans with path=shelf.shelf.local_path shelf_name=shelf.shelf.name %}<a href="{{ path }}">{{ shelf_name }}</a>{% endblocktrans %}
|
||||
{% if shelf.shelf.identifier|is_shelf_type:"readthrough" %}
|
||||
{% include 'snippets/shelve_button/shelve_button.html' %}
|
||||
{% if shelf.shelf.editable %}
|
||||
<div class="mb-3">
|
||||
{% include 'snippets/shelf_selector.html' with current=shelf.shelf class="is-small" %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="mb-3">
|
||||
{% include 'snippets/shelf_selector.html' with current=shelf.shelf class="is-small" %}
|
||||
</div>
|
||||
{% include 'snippets/shelve_button/shelve_button.html' %}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
{% block dropdown-list %}
|
||||
{% for shelf in user_shelves %}
|
||||
{% if shelf.identifier|is_shelf_type:"custom" %}
|
||||
{% if shelf.editable %}
|
||||
<li role="menuitem" class="dropdown-item p-0">
|
||||
<form name="shelve" action="/shelve/" method="post">
|
||||
{% csrf_token %}
|
||||
|
|
|
@ -41,17 +41,6 @@ def get_book_description(book):
|
|||
return book.description or book.parent_work.description
|
||||
|
||||
|
||||
@register.filter(name="is_shelf_type")
|
||||
def is_shelf_type(current_shelf, shelf_type):
|
||||
"""is this shelf a readthrough shelf?"""
|
||||
readthrough = current_shelf in ["to-read", "reading", "read"]
|
||||
if shelf_type == "readthrough" and bool(readthrough):
|
||||
return True
|
||||
if shelf_type == "custom" and not readthrough:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
@register.filter(name="next_shelf")
|
||||
def get_next_shelf(current_shelf):
|
||||
"""shelf you'd use to update reading progress"""
|
||||
|
|
Loading…
Reference in a new issue