2021-12-20 22:37:45 +00:00
{% extends 'layout.html' %}
{% load i18n %}
{% load static %}
2021-12-27 22:44:46 +00:00
{% load humanize %}
2021-12-20 22:37:45 +00:00
{% block title %}{% blocktrans %}{{ year }} in the books{% endblocktrans %}{% endblock %}
2021-12-20 22:38:18 +00:00
{% block head_links %}
< link rel = "stylesheet" href = "{% static " css / vendor / dm_serif_display . css " % } " >
{% endblock %}
2021-12-20 22:37:45 +00:00
{% block content %}
2021-12-22 14:11:05 +00:00
{% with display_name=summary_user.display_name %}
{% if user == summary_user %}
2021-12-21 10:43:09 +00:00
< div class = "columns" >
{% with year=paginated_years|first %}
2021-12-22 15:52:42 +00:00
{% if year %}
2021-12-21 10:43:09 +00:00
< div class = "column" >
2021-12-22 14:11:05 +00:00
< a href = "{% url 'annual-summary' summary_user.localname year %}" >
2021-12-21 10:43:09 +00:00
< span class = "icon icon-arrow-left" aria-hidden = "true" > < / span >
2021-12-22 14:11:05 +00:00
{{ year }}
2021-12-21 10:43:09 +00:00
< / a >
< / div >
2021-12-22 15:52:42 +00:00
{% endif %}
2021-12-21 10:43:09 +00:00
{% endwith %}
2021-12-21 10:52:33 +00:00
{% with year=paginated_years|last %}
2021-12-21 10:43:09 +00:00
{% if year %}
< div class = "column has-text-right" >
2021-12-22 14:11:05 +00:00
< a href = "{% url 'annual-summary' summary_user.localname year %}" >
{{ year }}
2021-12-21 10:43:09 +00:00
< span class = "icon icon-arrow-right" aria-hidden = "true" > < / span >
< / a >
< / div >
{% endif %}
{% endwith %}
< / div >
2021-12-22 14:11:05 +00:00
{% endif %}
2021-12-21 10:43:09 +00:00
2021-12-22 14:11:05 +00:00
< h1 class = "title is-1 is-serif has-text-centered" >
2021-12-21 12:50:05 +00:00
📚✨
{% blocktrans %}{{ year }} < em > in the books< / em > {% endblocktrans %}
✨📚
< / h1 >
2021-12-22 14:11:05 +00:00
< p class = "subtitle is-3 is-serif has-text-centered mb-5" >
{% blocktrans %}< em > {{ display_name }}’ s< / em > year of reading{% endblocktrans %}
< / p >
2021-12-20 22:37:45 +00:00
2021-12-22 14:12:56 +00:00
< details >
2021-12-22 18:47:39 +00:00
< summary class = "has-text-centered" >
< span role = "heading" aria-level = "2" class = "title is-6 has-text-success-dark" >
2021-12-22 17:15:20 +00:00
{% trans "Share this page" %}
< / span >
2021-12-22 14:12:56 +00:00
< / summary >
< div class = "columns mt-3" >
< div class = "column is-three-fifths is-offset-one-fifth" >
2021-12-22 14:13:42 +00:00
{% if year_key %}
< div class = "horizontal-copy mb-5" >
< textarea rows = "1" readonly class = "textarea is-small" aria-labelledby = "embed-label" data-copytext data-copytext-label = "{% trans 'Copy address' %}" data-copytext-success = "{% trans 'Copied!' %}" > {{ request.scheme|add:"://"|add:request.get_host|add:request.path }}?key={{ year_key }}< / textarea >
< / div >
{% endif %}
2021-12-20 22:37:45 +00:00
2021-12-22 14:12:56 +00:00
{% if user == summary_user %}
{% if year_key %}
< div class = "columns mb-2" >
< div class = "column pb-0" >
2021-12-22 17:15:20 +00:00
< p > {% trans "Sharing status: < strong > public with key< / strong > " %}< / p >
< p > {% trans "The page can be seen by anyone with the complete address." %}< / p >
2021-12-22 14:12:56 +00:00
< / div >
< form class = "column pb-0 is-narrow" method = "post" action = "{% url " summary-revoke-key " % } " id = "revoke-key" >
{% csrf_token %}
< input type = "hidden" name = "year" value = "{{ year }}" / >
2021-12-22 17:15:20 +00:00
< button class = "button is-danger is-outlined" type = "submit" > {% trans "Make page private" %}< / button >
2021-12-22 14:12:56 +00:00
< / form >
< / div >
{% else %}
< div class = "columns" >
< div class = "column pb-0" >
2021-12-22 17:15:20 +00:00
< p > {% trans "Sharing status: < strong > private< / strong > " %}< / p >
< p > {% trans "The page is private, only you can see it." %}< / p >
2021-12-22 14:12:56 +00:00
< / div >
< form class = "column pb-0 is-narrow" method = "post" action = "{% url " summary-add-key " % } " id = "add-key" >
{% csrf_token %}
< input type = "hidden" name = "year" value = "{{ year }}" / >
2021-12-22 17:15:20 +00:00
< button class = "button is-primary is-outlined" type = "submit" > {% trans "Make page public" %}< / button >
2021-12-22 14:12:56 +00:00
< / form >
< / div >
{% endif %}
2021-12-22 17:15:20 +00:00
< p class = "help" > {% trans "When you make your page private, the old key won’ t give access to the page anymore. A new key will be created if the page is once again made public." %}< / p >
2021-12-22 14:12:56 +00:00
{% endif %}
< / div >
< / div >
< / details >
< div class = "columns mt-1" >
< div class = "column is-one-fifth is-offset-two-fifths" >
< hr / >
< / div >
< / div >
2021-12-22 14:11:55 +00:00
{% if not books %}
< p class = "has-text-centered is-size-5" > {% blocktrans %}Sadly {{ display_name }} didn’ t finish any book in {{ year }}{% endblocktrans %}< / p >
{% else %}
2021-12-20 22:37:45 +00:00
< div class = "columns is-mobile" >
< div class = "column is-8 is-offset-2 has-text-centered" >
2021-12-20 22:38:18 +00:00
< h2 class = "title is-3 is-serif" >
2021-12-28 15:14:55 +00:00
{% blocktrans with pages_total=pages_total|intcomma %}In {{ year }}, {{ display_name }} read {{ books_total }} books< br / > for a total of {{ pages_total }} pages!{% endblocktrans %}
2021-12-20 22:37:45 +00:00
< / h2 >
< p class = "subtitle is-5" > {% trans "That’ s great!" %}< / p >
2021-12-27 21:16:27 +00:00
2021-12-20 22:38:18 +00:00
< p class = "title is-4 is-serif" >
2021-12-27 22:44:46 +00:00
{% blocktrans with pages=pages_average|intcomma %}That makes an average of {{ pages }} pages per book.{% endblocktrans %}
2021-12-20 22:37:45 +00:00
< / p >
{% if no_page_number %}
2021-12-27 21:16:27 +00:00
< p class = "subtitle is-6" >
{% blocktrans trimmed count counter=no_page_number %}
({{ no_page_number }} book doesn’ t have pages)
{% plural %}
({{ no_page_number }} books don’ t have pages)
{% endblocktrans %}
< / p >
2021-12-20 22:37:45 +00:00
{% endif %}
< / div >
< / div >
2021-12-21 13:44:21 +00:00
{% if book_pages_lowest and book_pages_highest %}
2021-12-28 15:14:55 +00:00
< div class = "columns is-align-items-center mt-5" >
2021-12-20 22:37:45 +00:00
< div class = "column is-2 is-offset-1" >
2021-12-28 16:40:13 +00:00
< a href = "{{ book_pages_lowest.local_path }}" > {% include 'snippets/book_cover.html' with book=book_pages_lowest cover_class='is-w-auto-tablet is-h-l-mobile' size='xxlarge' %}< / a >
2021-12-20 22:37:45 +00:00
< / div >
< div class = "column is-3" >
2021-12-22 14:11:05 +00:00
{% trans "Their shortest read this year…" %}
2021-12-20 22:38:18 +00:00
< p class = "title is-4 is-serif is-italic" >
2021-12-22 13:53:34 +00:00
< a href = "{{ book_pages_lowest.local_path }}" class = "has-text-success-dark" >
2021-12-20 22:37:45 +00:00
{{ book_pages_lowest.title }}
< / a >
< / p >
{% if book_pages_lowest.authors.exists %}
< p class = "subtitle is-5 mb-2" > {% trans "by" %}
2021-12-22 13:53:34 +00:00
{% include 'snippets/authors.html' with book=book_pages_lowest link_class="has-text-success-dark" %}
2021-12-20 22:37:45 +00:00
< / p >
{% endif %}
< p class = "subtitle is-6" >
{% with pages=book_pages_lowest.pages %}
{% blocktrans %}< strong > {{ pages }}< / strong > pages{% endblocktrans%}
{% endwith %}
< / p >
< / div >
< div class = "column is-2" >
2021-12-28 16:40:13 +00:00
< a href = "{{ book_pages_highest.local_path }}" > {% include 'snippets/book_cover.html' with book=book_pages_highest cover_class='is-w-auto-tablet is-h-l-mobile' size='xxlarge' %}< / a >
2021-12-20 22:37:45 +00:00
< / div >
< div class = "column is-3" >
2021-12-22 14:11:05 +00:00
{% trans "…and the longest" %}
2021-12-20 22:38:18 +00:00
< p class = "title is-4 is-serif is-italic" >
2021-12-22 13:53:34 +00:00
< a href = "{{ book_pages_lowest.local_path }}" class = "has-text-success-dark" >
2021-12-20 22:37:45 +00:00
{{ book_pages_highest.title }}
< / a >
< / p >
{% if book_pages_highest.authors.exists %}
< p class = "subtitle is-5 mb-2" > {% trans "by" %}
2021-12-22 13:53:34 +00:00
{% include 'snippets/authors.html' with book=book_pages_highest link_class="has-text-success-dark" %}
2021-12-20 22:37:45 +00:00
< / p >
{% endif %}
< p class = "subtitle is-6" >
{% with pages=book_pages_highest.pages %}
{% blocktrans %}< strong > {{ pages }}< / strong > pages{% endblocktrans%}
{% endwith %}
< / p >
< / div >
< / div >
2021-12-21 13:44:21 +00:00
{% endif %}
2021-12-20 22:37:45 +00:00
< div class = "columns" >
< div class = "column is-one-fifth is-offset-two-fifths" >
< hr / >
< / div >
< / div >
2021-12-22 14:11:05 +00:00
{% if ratings_total > 0 %}
2021-12-20 22:37:45 +00:00
< div class = "columns" >
< div class = "column has-text-centered" >
2021-12-20 22:38:18 +00:00
< h2 class = "title is-3 is-serif" >
2021-12-22 14:11:05 +00:00
{% blocktrans %}{{ display_name }} left {{ ratings_total }} ratings, < br / > their average rating is {{ rating_average }}{% endblocktrans %}
2021-12-20 22:37:45 +00:00
< / h2 >
< / div >
< / div >
< div class = "columns is-align-items-center" >
2021-12-28 16:40:13 +00:00
< div class = "column is-2 is-offset-4" >
< a href = "{{ book_rating_highest.book.local_path }}" > {% include 'snippets/book_cover.html' with book=book_rating_highest.book cover_class='is-w-xl-tablet is-h-l-mobile' size='xxlarge' %}< / a >
2021-12-20 22:37:45 +00:00
< / div >
2021-12-27 21:16:27 +00:00
{% if book_rating_highest %}
2021-12-21 10:43:45 +00:00
< div class = "column is-4" >
2021-12-22 14:11:05 +00:00
{% trans "Their best rated review" %}
2021-12-20 22:38:18 +00:00
< p class = "title is-4 is-serif is-italic" >
2021-12-22 13:53:34 +00:00
< a href = "{{ book_rating_highest.book.local_path }}" class = "has-text-success-dark" >
2021-12-20 22:37:45 +00:00
{{ book_rating_highest.book.title }}
< / a >
< / p >
{% if book_rating_highest.book.authors.exists %}
< p class = "subtitle is-5 mb-2" > {% trans "by" %}
2021-12-22 13:53:34 +00:00
{% include 'snippets/authors.html' with book=book_rating_highest.book link_class="has-text-success-dark" %}
2021-12-20 22:37:45 +00:00
< / p >
{% endif %}
< p class = "subtitle is-6" >
{% with rating=book_rating_highest.rating|floatformat %}
2021-12-22 14:11:05 +00:00
{% blocktrans %}Their rating: < strong > {{ rating }}< / strong > {% endblocktrans%}
2021-12-20 22:37:45 +00:00
{% endwith %}
< / p >
< / div >
2021-12-27 21:16:27 +00:00
{% endif %}
2021-12-20 22:37:45 +00:00
< / div >
< div class = "columns" >
< div class = "column is-one-fifth is-offset-two-fifths" >
< hr / >
< / div >
< / div >
2021-12-22 14:11:05 +00:00
{% endif %}
2021-12-20 22:37:45 +00:00
< div class = "columns" >
< div class = "column has-text-centered" >
2021-12-20 22:38:18 +00:00
< h2 class = "title is-3 is-serif" >
2021-12-22 14:11:05 +00:00
{% blocktrans %}All the books {{ display_name }} read in 2021{% endblocktrans %}
2021-12-20 22:37:45 +00:00
< / h2 >
< / div >
< / div >
< div class = "columns" >
< div class = "column is-10 is-offset-1" >
< div class = "books-grid" >
{% for book in books %}
{% if book.id in best_ratings_books_ids %}
2021-12-22 13:53:34 +00:00
< a href = "{{ book.local_path }}" class = "has-text-centered is-big has-text-success-dark" >
2021-12-28 09:29:35 +00:00
{% include 'snippets/book_cover.html' with book=book cover_class='is-w-auto' size='xxlarge' %}
2021-12-20 22:38:18 +00:00
< span class = "book-title is-serif is-size-5" >
2021-12-20 22:37:45 +00:00
{{ book.title }}
< / span >
< / a >
{% else %}
2021-12-22 13:53:34 +00:00
< a href = "{{ book.local_path }}" class = "has-text-centered has-text-success-dark" >
2021-12-28 16:40:13 +00:00
{% include 'snippets/book_cover.html' with book=book cover_class='is-w-auto' size='xlarge' %}
2021-12-20 22:38:18 +00:00
< span class = "book-title is-serif is-size-6" >
2021-12-20 22:37:45 +00:00
{{ book.title }}
< / span >
< / a >
{% endif %}
{% endfor %}
< / div >
< / div >
< / div >
2021-12-22 14:11:05 +00:00
{% endif %}
{% endwith %}
2021-12-20 22:37:45 +00:00
{% endblock %}