Cleans up landing page, since we're here

This commit is contained in:
Mouse Reeve 2021-08-07 16:37:51 -07:00
parent 33c8849552
commit 4d8bd3ad93
4 changed files with 26 additions and 21 deletions

View file

@ -7,41 +7,41 @@
</div> </div>
<section class="tile is-ancestor"> <section class="tile is-ancestor">
<div class="tile is-vertical"> <div class="tile is-vertical is-6">
<div class="tile is-parent"> <div class="tile is-parent">
<div class="tile is-child box has-background-white-ter"> <div class="tile is-child box has-background-white-ter">
{% include 'landing/large-book.html' with book=books.0 %} {% include 'landing/large-book.html' with book=books.has_description.0 %}
</div> </div>
</div> </div>
<div class="tile"> <div class="tile">
<div class="tile is-parent is-6"> <div class="tile is-parent is-6">
<div class="tile is-child box has-background-white-ter"> <div class="tile is-child box has-background-white-ter">
{% include 'landing/small-book.html' with book=books.1 %} {% include 'landing/small-book.html' with book=books.no_description.0 %}
</div> </div>
</div> </div>
<div class="tile is-parent is-6"> <div class="tile is-parent is-6">
<div class="tile is-child box has-background-white-ter"> <div class="tile is-child box has-background-white-ter">
{% include 'landing/small-book.html' with book=books.2 %} {% include 'landing/small-book.html' with book=books.no_description.1 %}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="tile is-vertical"> <div class="tile is-vertical is-6">
<div class="tile"> <div class="tile">
<div class="tile is-parent is-6"> <div class="tile is-parent is-6">
<div class="tile is-child box has-background-white-ter"> <div class="tile is-child box has-background-white-ter">
{% include 'landing/small-book.html' with book=books.3 %} {% include 'landing/small-book.html' with book=books.no_description.2 %}
</div> </div>
</div> </div>
<div class="tile is-parent is-6"> <div class="tile is-parent is-6">
<div class="tile is-child box has-background-white-ter"> <div class="tile is-child box has-background-white-ter">
{% include 'landing/small-book.html' with book=books.4 %} {% include 'landing/small-book.html' with book=books.no_description.3 %}
</div> </div>
</div> </div>
</div> </div>
<div class="tile is-parent"> <div class="tile is-parent">
<div class="tile is-child box has-background-white-ter"> <div class="tile is-child box has-background-white-ter">
{% include 'landing/large-book.html' with book=books.5 %} {% include 'landing/large-book.html' with book=books.has_description.1 %}
</div> </div>
</div> </div>
</div> </div>

View file

@ -5,7 +5,7 @@
{% if book %} {% if book %}
{% with book=book %} {% with book=book %}
<div class="columns is-gapless"> <div class="columns is-gapless">
<div class="column is-5-tablet is-cover"> <div class="column is-7-tablet is-cover">
<a <a
class="align to-b to-l" class="align to-b to-l"
href="{{ book.local_path }}" href="{{ book.local_path }}"

View file

@ -4,7 +4,7 @@
{% if book %} {% if book %}
{% with book=book %} {% with book=book %}
<a href="{{ book.local_path }}"> <a href="{{ book.local_path }}">
{% include 'snippets/book_cover.html' with cover_class='is-w-l-mobile is-h-l-tablet is-w-auto align to-b to-l' %} {% include 'snippets/book_cover.html' with cover_class='is-w-l-mobile is-w-auto align to-b to-l' %}
</a> </a>
{% include 'snippets/stars.html' with rating=book|rating:request.user %} {% include 'snippets/stars.html' with rating=book|rating:request.user %}

View file

@ -164,8 +164,8 @@ def is_blocked(viewer, user):
def get_landing_books(): def get_landing_books():
"""list of books for the landing page""" """list of books for the landing page"""
return list(
set( options = (
models.Edition.objects.filter( models.Edition.objects.filter(
review__published_date__isnull=False, review__published_date__isnull=False,
review__deleted=False, review__deleted=False,
@ -174,6 +174,11 @@ def get_landing_books():
) )
.exclude(cover__exact="") .exclude(cover__exact="")
.annotate(Max("review__published_date")) .annotate(Max("review__published_date"))
.order_by("-review__published_date__max")[:6] .order_by("-review__published_date__max")
)
) )
has_description = options.exclude(description=None).exclude(description="")
return {
"has_description": has_description[:2],
"no_description": options.exclude(id__in=has_description)[:4],
}