forked from mirrors/bookwyrm
refactor shelf activity on book page
- disallow moving from custom shelf to a reading status shelf with shelf_selector - always use shelve_button for moving books from a reading status shelf - redesign shelf information as a list of boxes
This commit is contained in:
parent
403c0dc3a3
commit
168a2488e2
3 changed files with 32 additions and 4 deletions
|
@ -153,12 +153,25 @@
|
|||
|
||||
{# user's relationship to the book #}
|
||||
<div class="block">
|
||||
{% if user_shelfbooks.count > 0 %}
|
||||
<h2 class="title is-5">
|
||||
{% trans "You have shelved this edition in:" %}
|
||||
</h2>
|
||||
<ul>
|
||||
{% for shelf in user_shelfbooks %}
|
||||
<p>
|
||||
{% blocktrans with path=shelf.shelf.local_path shelf_name=shelf.shelf.name %}This edition is on your <a href="{{ path }}">{{ shelf_name }}</a> shelf.{% endblocktrans %}
|
||||
{% include 'snippets/shelf_selector.html' with current=shelf.shelf %}
|
||||
</p>
|
||||
<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' %}
|
||||
{% else %}
|
||||
<div class="mb-3">
|
||||
{% include 'snippets/shelf_selector.html' with current=shelf.shelf class="is-small" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% for shelf in other_edition_shelves %}
|
||||
<p>
|
||||
{% blocktrans with book_path=shelf.book.local_path shelf_path=shelf.shelf.local_path shelf_name=shelf.shelf.name %}A <a href="{{ book_path }}">different edition</a> of this book is on your <a href="{{ shelf_path }}">{{ shelf_name }}</a> shelf.{% endblocktrans %}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{% extends 'components/dropdown.html' %}
|
||||
{% load i18n %}
|
||||
{% load bookwyrm_tags %}
|
||||
|
||||
{% block dropdown-trigger %}
|
||||
<span>{% trans "Move book" %}</span>
|
||||
<span class="icon icon-arrow-down" aria-hidden="true"></span>
|
||||
|
@ -7,6 +9,7 @@
|
|||
|
||||
{% block dropdown-list %}
|
||||
{% for shelf in user_shelves %}
|
||||
{% if shelf.identifier|is_shelf_type:"custom" %}
|
||||
<li role="menuitem" class="dropdown-item p-0">
|
||||
<form name="shelve" action="/shelve/" method="post">
|
||||
{% csrf_token %}
|
||||
|
@ -16,6 +19,7 @@
|
|||
<button class="button is-fullwidth is-small shelf-option is-radiusless is-white" type="submit" {% if shelf.identifier == current.identifier %}disabled{% endif %}><span>{{ shelf.name }}</span></button>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<li class="navbar-divider" role="separator"></li>
|
||||
<li role="menuitem" class="dropdown-item p-0">
|
||||
|
|
|
@ -41,6 +41,17 @@ def get_book_description(book):
|
|||
return book.description or book.parent_work.description
|
||||
|
||||
|
||||
@register.filter(name="is_shelf_type")
|
||||
def 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 readthrough == True:
|
||||
return True
|
||||
if shelf_type == "custom" and readthrough == False:
|
||||
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