mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-06-03 05:49:35 +00:00
Updates view logic
This commit is contained in:
parent
bd3acdbf31
commit
44d21d1ba4
|
@ -106,16 +106,11 @@
|
||||||
(showing {{ start }}-{{ end }})
|
(showing {{ start }}-{{ end }})
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if show_shelves_filter_msg %}
|
|
||||||
- {% trans "We couldn't find any books that matched" %} "{{ shelves_filter_query }}"
|
|
||||||
{% endif %}
|
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</h2>
|
</h2>
|
||||||
{% if books|length > 0 %}
|
{% include 'shelf/shelves_filters.html' with user=user query=query %}
|
||||||
{% include 'shelf/shelves_filters.html' with user=user query=query %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% if is_self and shelf.id %}
|
{% if is_self and shelf.id %}
|
||||||
|
@ -215,7 +210,12 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p><em>{% trans "This shelf is empty." %}</em></p>
|
<p><em>{% if shelves_filter_query %}
|
||||||
|
{% trans "We couldn't find any books that matched" %} "{{ shelves_filter_query }}"
|
||||||
|
{% else %}
|
||||||
|
{% trans "This shelf is empty." %}
|
||||||
|
{% endif %}
|
||||||
|
</em></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -94,8 +94,7 @@ class Shelf(View):
|
||||||
books = sort_books(books, request.GET.get("sort"))
|
books = sort_books(books, request.GET.get("sort"))
|
||||||
|
|
||||||
if shelves_filter_query:
|
if shelves_filter_query:
|
||||||
books = search(shelves_filter_query, books=books) or books
|
books = search(shelves_filter_query, books=books)
|
||||||
show_shelves_filter_msg = True
|
|
||||||
|
|
||||||
paginated = Paginator(
|
paginated = Paginator(
|
||||||
books,
|
books,
|
||||||
|
@ -115,7 +114,6 @@ class Shelf(View):
|
||||||
page.number, on_each_side=2, on_ends=1
|
page.number, on_each_side=2, on_ends=1
|
||||||
),
|
),
|
||||||
"shelves_filter_query": shelves_filter_query,
|
"shelves_filter_query": shelves_filter_query,
|
||||||
"show_shelves_filter_msg": show_shelves_filter_msg,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TemplateResponse(request, "shelf/shelf.html", data)
|
return TemplateResponse(request, "shelf/shelf.html", data)
|
||||||
|
|
Loading…
Reference in a new issue