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>
<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-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 class="tile">
<div class="tile is-parent is-6">
<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 class="tile is-parent is-6">
<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 class="tile is-vertical">
<div class="tile is-vertical is-6">
<div class="tile">
<div class="tile is-parent is-6">
<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 class="tile is-parent is-6">
<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 class="tile is-parent">
<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>

View file

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

View file

@ -4,7 +4,7 @@
{% if book %}
{% with book=book %}
<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>
{% include 'snippets/stars.html' with rating=book|rating:request.user %}

View file

@ -164,16 +164,21 @@ def is_blocked(viewer, user):
def get_landing_books():
"""list of books for the landing page"""
return list(
set(
models.Edition.objects.filter(
review__published_date__isnull=False,
review__deleted=False,
review__user__local=True,
review__privacy__in=["public", "unlisted"],
)
.exclude(cover__exact="")
.annotate(Max("review__published_date"))
.order_by("-review__published_date__max")[:6]
options = (
models.Edition.objects.filter(
review__published_date__isnull=False,
review__deleted=False,
review__user__local=True,
review__privacy__in=["public", "unlisted"],
)
.exclude(cover__exact="")
.annotate(Max("review__published_date"))
.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],
}