forked from mirrors/bookwyrm
Move stars into header for ratings
This commit is contained in:
parent
07dbc4c6c0
commit
9e5ebf9807
4 changed files with 120 additions and 119 deletions
|
@ -1,7 +1,7 @@
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
<p class="stars">
|
<span class="stars">
|
||||||
<span class="is-sr-only">
|
<span class="is-sr-only">
|
||||||
{% if rating %}
|
{% if rating %}
|
||||||
{% blocktranslate trimmed with rating=rating|floatformat count counter=rating|length %}
|
{% blocktranslate trimmed with rating=rating|floatformat count counter=rating|length %}
|
||||||
|
@ -23,5 +23,5 @@
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
></span>
|
></span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</p>
|
</span>
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
|
|
|
@ -6,120 +6,122 @@
|
||||||
{% with status_type=status.status_type %}
|
{% with status_type=status.status_type %}
|
||||||
<div
|
<div
|
||||||
class="block"
|
class="block"
|
||||||
{% firstof "reviewBody" as body_prop %}
|
{% if status_type == "Review" %}
|
||||||
{% firstof 'itemprop="reviewRating" itemscope itemtype="https://schema.org/Rating"' as rating_type %}
|
itemprop="rating"
|
||||||
|
itemtype="https://schema.org/Rating"
|
||||||
itemprop="rating"
|
{% endif %}
|
||||||
itemtype="https://schema.org/Rating"
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
{% if not hide_book %}
|
{% if not hide_book %}
|
||||||
{% with book=status.book|default:status.mention_books.first %}
|
{% with book=status.book|default:status.mention_books.first %}
|
||||||
<div class="column is-narrow">
|
<div class="column is-narrow is-hidden-mobile">
|
||||||
<div>
|
|
||||||
<a href="{{ book.local_path }}">{% include 'snippets/book_cover.html' with book=book %}</a>
|
<a href="{{ book.local_path }}">{% include 'snippets/book_cover.html' with book=book %}</a>
|
||||||
{% include 'snippets/stars.html' with rating=book|rating:request.user %}
|
{% include 'snippets/stars.html' with rating=book|rating:request.user %}
|
||||||
{% include 'snippets/shelve_button/shelve_button.html' with book=book %}
|
{% include 'snippets/shelve_button/shelve_button.html' with book=book %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% endwith %}
|
||||||
{% endwith %}
|
{% endif %}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<article class="column">
|
<article class="column">
|
||||||
{% if status_type == 'Review' %}
|
{% if status_type == 'Review' %}
|
||||||
<header class="mb-2">
|
<header class="mb-2">
|
||||||
<h3
|
<h3
|
||||||
class="title is-5 has-subtitle"
|
class="title is-5 has-subtitle"
|
||||||
dir="auto"
|
dir="auto"
|
||||||
itemprop="name"
|
itemprop="name"
|
||||||
>
|
|
||||||
{{ status.name|escape }}
|
|
||||||
</h3>
|
|
||||||
|
|
||||||
<h4 class="subtitle is-6">
|
|
||||||
<span
|
|
||||||
class="is-hidden"
|
|
||||||
{{ rating_type }}
|
|
||||||
>
|
>
|
||||||
<meta itemprop="ratingValue" content="{{ status.rating|floatformat }}">
|
{{ status.name|escape }}
|
||||||
|
</h3>
|
||||||
|
|
||||||
{# @todo Is it possible to not hard-code the value? #}
|
<h4 class="subtitle is-6">
|
||||||
<meta itemprop="bestRating" content="5">
|
<span
|
||||||
</span>
|
class="is-hidden"
|
||||||
{% include 'snippets/stars.html' with rating=status.rating %}
|
{% if status_type == "Review" %}
|
||||||
</h4>
|
itemprop="reviewRating"
|
||||||
</header>
|
itemscope
|
||||||
{% endif %}
|
itemtype="https://schema.org/Rating"
|
||||||
|
{% endif %}
|
||||||
|
>
|
||||||
|
<meta itemprop="ratingValue" content="{{ status.rating|floatformat }}">
|
||||||
|
|
||||||
{% if status.content_warning %}
|
{# @todo Is it possible to not hard-code the value? #}
|
||||||
<div>
|
<meta itemprop="bestRating" content="5">
|
||||||
<p>{{ status.content_warning }}</p>
|
</span>
|
||||||
|
{% include 'snippets/stars.html' with rating=status.rating %}
|
||||||
{% trans "Show more" as button_text %}
|
</h4>
|
||||||
|
</header>
|
||||||
{% with text=button_text class="is-small" controls_text="show-status-cw" controls_uid=status.id %}
|
|
||||||
{% include 'snippets/toggle/open_button.html' %}
|
|
||||||
{% endwith %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<div
|
|
||||||
{% if status.content_warning %}
|
|
||||||
id="show-status-cw-{{ status.id }}"
|
|
||||||
class="is-hidden"
|
|
||||||
{% endif %}
|
|
||||||
>
|
|
||||||
{% if status.content_warning %}
|
|
||||||
{% trans "Show less" as button_text %}
|
|
||||||
|
|
||||||
{% with text=button_text class="is-small" controls_text="show-status-cw" controls_uid=status.id %}
|
|
||||||
{% include 'snippets/toggle/close_button.html' %}
|
|
||||||
{% endwith %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if status.quote %}
|
{% if status.content_warning %}
|
||||||
<div class="quote block">
|
<div>
|
||||||
<blockquote dir="auto" class="content mb-2">{{ status.quote | safe }}</blockquote>
|
<p>{{ status.content_warning }}</p>
|
||||||
|
|
||||||
<p> — {% include 'snippets/book_titleby.html' with book=status.book %}</p>
|
{% trans "Show more" as button_text %}
|
||||||
|
|
||||||
|
{% with text=button_text class="is-small" controls_text="show-status-cw" controls_uid=status.id %}
|
||||||
|
{% include 'snippets/toggle/open_button.html' %}
|
||||||
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if status.content and status_type != 'GeneratedNote' and status_type != 'Announce' %}
|
<div
|
||||||
{% with full=status.content|safe no_trim=status.content_warning itemprop=body_prop %}
|
{% if status.content_warning %}
|
||||||
{% include 'snippets/trimmed_text.html' %}
|
id="show-status-cw-{{ status.id }}"
|
||||||
{% endwith %}
|
class="is-hidden"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
>
|
||||||
|
{% if status.content_warning %}
|
||||||
|
{% trans "Show less" as button_text %}
|
||||||
|
|
||||||
{% if status.attachments.exists %}
|
{% with text=button_text class="is-small" controls_text="show-status-cw" controls_uid=status.id %}
|
||||||
<div class="block">
|
{% include 'snippets/toggle/close_button.html' %}
|
||||||
<div class="columns">
|
{% endwith %}
|
||||||
{% for attachment in status.attachments.all %}
|
{% endif %}
|
||||||
<div class="column is-narrow">
|
|
||||||
<figure class="image is-128x128">
|
|
||||||
<a
|
|
||||||
href="/images/{{ attachment.image }}"
|
|
||||||
target="_blank"
|
|
||||||
aria-label="{% trans 'Open image in new window' %}"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src="/images/{{ attachment.image }}"
|
|
||||||
|
|
||||||
{% if attachment.caption %}
|
{% if status.quote %}
|
||||||
alt="{{ attachment.caption }}"
|
<div class="quote block">
|
||||||
title="{{ attachment.caption }}"
|
<blockquote dir="auto" class="content mb-2">{{ status.quote | safe }}</blockquote>
|
||||||
{% endif %}
|
|
||||||
>
|
<p> — {% include 'snippets/book_titleby.html' with book=status.book %}</p>
|
||||||
</a>
|
|
||||||
</figure>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% endif %}
|
||||||
{% endif %}
|
|
||||||
</div>
|
{% if status.content and status_type != 'GeneratedNote' and status_type != 'Announce' %}
|
||||||
</article>
|
{% with full=status.content|safe no_trim=status.content_warning itemprop="reviewBody" %}
|
||||||
|
{% include 'snippets/trimmed_text.html' %}
|
||||||
|
{% endwith %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if status.attachments.exists %}
|
||||||
|
<div class="block">
|
||||||
|
<div class="columns">
|
||||||
|
{% for attachment in status.attachments.all %}
|
||||||
|
<div class="column is-narrow">
|
||||||
|
<figure class="image is-128x128">
|
||||||
|
<a
|
||||||
|
href="/images/{{ attachment.image }}"
|
||||||
|
target="_blank"
|
||||||
|
aria-label="{% trans 'Open image in new window' %}"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src="/images/{{ attachment.image }}"
|
||||||
|
|
||||||
|
{% if attachment.caption %}
|
||||||
|
alt="{{ attachment.caption }}"
|
||||||
|
title="{{ attachment.caption }}"
|
||||||
|
{% endif %}
|
||||||
|
>
|
||||||
|
</a>
|
||||||
|
</figure>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
|
@ -3,29 +3,9 @@
|
||||||
{% load bookwyrm_tags %}
|
{% load bookwyrm_tags %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% if status_type == 'Rating' %}
|
|
||||||
<div
|
|
||||||
class="block"
|
|
||||||
{% firstof 'itemprop="reviewRating" itemscope itemtype="https://schema.org/Rating"' as rating_type %}
|
|
||||||
itemprop="rating"
|
|
||||||
itemtype="https://schema.org/Rating"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<span class="is-sr-only" {{ rating_type }}>
|
|
||||||
<meta itemprop="ratingValue" content="{{ status.rating|floatformat }}">
|
|
||||||
|
|
||||||
{# @todo Is it possible to not hard-code the value? #}
|
|
||||||
<meta itemprop="bestRating" content="5">
|
|
||||||
</span>
|
|
||||||
|
|
||||||
{% include 'snippets/stars.html' with rating=status.rating %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if not hide_book %}
|
{% if not hide_book %}
|
||||||
{% with book=status.book|default:status.mention_books.first %}
|
{% with book=status.book|default:status.mention_books.first %}
|
||||||
<div class="columns">
|
<div class="columns is-mobile">
|
||||||
<div class="column is-narrow">
|
<div class="column is-narrow">
|
||||||
<div>
|
<div>
|
||||||
<a href="{{ book.local_path }}">{% include 'snippets/book_cover.html' with book=book size="small" %}</a>
|
<a href="{{ book.local_path }}">{% include 'snippets/book_cover.html' with book=book size="small" %}</a>
|
||||||
|
|
|
@ -40,10 +40,29 @@
|
||||||
|
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if status.book %}
|
{% if status.book %}
|
||||||
<a href="/book/{{ status.book.id }}">{{ status.book.title }}</a>
|
{% if status.status_type == 'GeneratedNote' or status.status_type == 'Rating' %}
|
||||||
|
<a href="/book/{{ status.book.id }}">{{ status.book.title }}</a>{% if status.status_type == 'Rating' %}:
|
||||||
|
<span
|
||||||
|
itemprop="reviewRating"
|
||||||
|
itemscope
|
||||||
|
itemtype="https://schema.org/Rating"
|
||||||
|
>
|
||||||
|
<span class="is-hidden" {{ rating_type }}>
|
||||||
|
<meta itemprop="ratingValue" content="{{ status.rating|floatformat }}">
|
||||||
|
|
||||||
|
{# @todo Is it possible to not hard-code the value? #}
|
||||||
|
<meta itemprop="bestRating" content="5">
|
||||||
|
</span>
|
||||||
|
|
||||||
|
{% include 'snippets/stars.html' with rating=status.rating %}
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{% include 'snippets/book_titleby.html' with book=status.book %}
|
||||||
|
{% endif %}
|
||||||
{% elif status.mention_books %}
|
{% elif status.mention_books %}
|
||||||
<a href="/book/{{ status.mention_books.first.id }}">{{ status.mention_books.first.title }}</a>
|
<a href="/book/{{ status.mention_books.first.id }}">{{ status.mention_books.first.title }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if status.progress %}
|
{% if status.progress %}
|
||||||
|
|
Loading…
Reference in a new issue