forked from mirrors/bookwyrm
Sort shelves by shelfbook updated date
This commit is contained in:
parent
670036f8a9
commit
885bb023a3
3 changed files with 8 additions and 3 deletions
|
@ -122,7 +122,7 @@
|
||||||
|
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<div>
|
<div>
|
||||||
{% include 'snippets/shelf.html' with shelf=shelf ratings=ratings %}
|
{% include 'snippets/shelf.html' with shelf=shelf books=books ratings=ratings %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% load humanize %}
|
{% load humanize %}
|
||||||
{% load bookwyrm_tags %}
|
{% load bookwyrm_tags %}
|
||||||
{% if shelf.books.all|length > 0 %}
|
{% if books|length > 0 %}
|
||||||
<table class="table is-striped is-fullwidth">
|
<table class="table is-striped is-fullwidth">
|
||||||
|
|
||||||
<tr class="book-preview">
|
<tr class="book-preview">
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
</th>
|
</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% for book in shelf.books.all %}
|
{% for book in books %}
|
||||||
<tr class="book-preview">
|
<tr class="book-preview">
|
||||||
<td>
|
<td>
|
||||||
{% include 'snippets/book_cover.html' with book=book size="small" %}
|
{% include 'snippets/book_cover.html' with book=book size="small" %}
|
||||||
|
|
|
@ -765,12 +765,17 @@ def shelf_page(request, username, shelf_identifier):
|
||||||
if is_api_request(request):
|
if is_api_request(request):
|
||||||
return ActivitypubResponse(shelf.to_activity(**request.GET))
|
return ActivitypubResponse(shelf.to_activity(**request.GET))
|
||||||
|
|
||||||
|
books = models.ShelfBook.objects.filter(
|
||||||
|
added_by=user, shelf=shelf
|
||||||
|
).order_by('-updated_date').all()
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'title': '%s\'s %s shelf' % (user.display_name, shelf.name),
|
'title': '%s\'s %s shelf' % (user.display_name, shelf.name),
|
||||||
'user': user,
|
'user': user,
|
||||||
'is_self': is_self,
|
'is_self': is_self,
|
||||||
'shelves': shelves.all(),
|
'shelves': shelves.all(),
|
||||||
'shelf': shelf,
|
'shelf': shelf,
|
||||||
|
'books': [b.book for b in books],
|
||||||
}
|
}
|
||||||
|
|
||||||
return TemplateResponse(request, 'shelf.html', data)
|
return TemplateResponse(request, 'shelf.html', data)
|
||||||
|
|
Loading…
Reference in a new issue