Merge branch 'main' into group-list-button

This commit is contained in:
Hugh Rundle
2022-01-03 10:28:59 +11:00
20 changed files with 907 additions and 886 deletions

View File

@ -73,7 +73,7 @@
{% endif %}
{% if annual_summary_year and tab.key == 'home' %}
<section class="block" data-hide="hide_annual_summary_{{ annual_summary_year }}">
<section class="block is-hidden" data-hide="hide_annual_summary_{{ annual_summary_year }}">
{% include 'feed/summary_card.html' with year=annual_summary_year %}
<hr>
</section>

View File

@ -63,16 +63,18 @@
{% endfor %}
{% if shelf.identifier == 'all' %}
{% for shelved_in in book.shelves.all %}
{% for user_shelf in user_shelves %}
{% if user_shelf in book.shelves.all %}
<li class="navbar-divider m-0" role="separator" ></li>
<li role="menuitem" class="dropdown-item p-0">
<form name="shelve" action="/unshelve/" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="{{ book.id }}">
<input type="hidden" name="shelf" value="{{ shelved_in.id }}">
<button class="button is-fullwidth is-small is-radiusless is-danger is-light" type="submit">{% trans "Remove from" %} {{ shelved_in.name }}</button>
<input type="hidden" name="shelf" value="{{ user_shelf.id }}">
<button class="button is-fullwidth is-small is-radiusless is-danger is-light" type="submit">{% trans "Remove from" %} {{ user_shelf.name }}</button>
</form>
</li>
{% endif %}
{% endfor %}
{% else %}
<li class="navbar-divider" role="separator" ></li>

View File

@ -72,9 +72,13 @@ class Shelf(View):
"start_date"
)
if shelf_identifier:
books = books.annotate(shelved_date=F("shelfbook__shelved_date"))
else:
# sorting by shelved date will cause duplicates in the "all books" view
books = books.annotate(shelved_date=F("updated_date"))
books = books.annotate(
rating=Subquery(reviews.values("rating")[:1]),
shelved_date=F("shelfbook__shelved_date"),
start_date=Subquery(reading.values("start_date")[:1]),
finish_date=Subquery(reading.values("finish_date")[:1]),
author=Subquery(