moviewyrm/bookwyrm/templates/snippets/status/content_status.html

157 lines
6.7 KiB
HTML
Raw Normal View History

2021-04-20 16:54:02 +00:00
{% load bookwyrm_tags %}
2021-05-11 22:14:42 +00:00
{% load markdown %}
2021-04-20 16:54:02 +00:00
{% load i18n %}
2021-06-07 16:13:24 +00:00
{% load static %}
2021-09-05 23:00:40 +00:00
{% load humanize %}
2021-04-20 16:54:02 +00:00
{% with status_type=status.status_type %}
<div
class="block"
2021-04-20 18:06:14 +00:00
{% if status_type == "Review" %}
itemprop="rating"
itemtype="https://schema.org/Rating"
{% endif %}
2021-04-20 16:54:02 +00:00
>
<div class="columns is-gapless">
2021-04-20 18:06:14 +00:00
{% if not hide_book %}
{% with book=status.book|default:status.mention_books.first %}
{% if book %}
<div class="column is-cover">
<div class="columns is-mobile is-gapless">
<div class="column is-cover">
2021-05-24 14:18:05 +00:00
<a href="{{ book.local_path }}">{% include 'snippets/book_cover.html' with book=book cover_class='is-w-s-mobile is-h-l-tablet' size_mobile='medium' size='large' %}</a>
{% include 'snippets/stars.html' with rating=book|rating:request.user %}
{% include 'snippets/shelve_button/shelve_button.html' with book=book %}
</div>
<div class="column ml-3-mobile is-hidden-tablet">
<p>{{ book|book_description|to_markdown|default:""|safe|truncatewords_html:15 }}</p>
</div>
</div>
</div>
{% endif %}
{% endwith %}
2021-04-20 16:54:02 +00:00
{% endif %}
<article class="column ml-3-tablet my-3-mobile">
2021-04-20 18:06:14 +00:00
{% if status_type == 'Review' %}
<header class="mb-2">
<h3
class="title is-5 has-subtitle"
dir="auto"
itemprop="name"
>
{{ status.name|escape }}
</h3>
<h4 class="subtitle is-6">
<span
class="is-hidden"
{% if status_type == "Review" %}
itemprop="reviewRating"
itemscope
itemtype="https://schema.org/Rating"
{% endif %}
>
<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 %}
</h4>
</header>
2021-04-20 16:54:02 +00:00
{% endif %}
2021-04-20 18:06:14 +00:00
{% if status.content_warning %}
<div class="notification p-2 is-clearfix is-warning is-light">
<p class="is-pulled-left is-flex">
{% trans "Content warning" as text %}
<span class="icon icon-warning" title="{{ text }}">
<span class="is-sr-only">{{ text }}</span>
</span>
{{ status.content_warning }}
</p>
2021-04-20 16:54:02 +00:00
{% trans "Show status" as button_text %}
2021-04-20 16:54:02 +00:00
{% with text=button_text class="is-small is-pulled-right" icon_with_text="arrow-down" controls_text="show_status_cw" controls_uid=status.id %}
2021-04-20 18:06:14 +00:00
{% include 'snippets/toggle/open_button.html' %}
{% endwith %}
2021-04-20 16:54:02 +00:00
</div>
{% endif %}
2021-04-20 18:06:14 +00:00
<div
{% if status.content_warning %}
id="show_status_cw_{{ status.id }}"
2021-04-20 18:06:14 +00:00
class="is-hidden"
{% endif %}
>
{% if status.quote %}
<div class="quote block">
2021-09-22 19:18:12 +00:00
<blockquote dir="auto" class="content mb-2 preserve-whitespace">{{ status.quote|safe }}</blockquote>
2021-04-20 18:06:14 +00:00
2021-09-05 23:00:40 +00:00
<p>
&mdash; {% include 'snippets/book_titleby.html' with book=status.book %}
{% if status.position %}
{% if status.position_mode == 'PG' %}
{% blocktrans with page=status.position|intcomma %}(Page {{ page }}){% endblocktrans %}
{% else %}
{% blocktrans with percent=status.position %}({{ percent }}%){% endblocktrans %}
{% endif %}
{% endif %}
</p>
2021-04-20 18:06:14 +00:00
</div>
{% endif %}
{% if status.content and status_type != 'GeneratedNote' and status_type != 'Announce' %}
{% 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
2021-06-07 16:13:24 +00:00
href="{% get_media_prefix %}{{ attachment.image }}"
2021-04-20 18:06:14 +00:00
target="_blank"
aria-label="{% trans 'Open image in new window' %}"
2021-04-20 16:54:02 +00:00
>
2021-04-20 18:06:14 +00:00
<img
2021-06-07 16:13:24 +00:00
src="{% get_media_prefix %}{{ attachment.image }}"
2021-04-20 18:06:14 +00:00
{% if attachment.caption %}
alt="{{ attachment.caption }}"
title="{{ attachment.caption }}"
{% endif %}
>
</a>
</figure>
</div>
{% endfor %}
</div>
2021-04-20 16:54:02 +00:00
</div>
2021-04-20 18:06:14 +00:00
{% endif %}
{% if status.content_warning %}
{% trans "Hide status" as button_text %}
{% with text=button_text class="is-small" controls_text="show_status_cw" controls_uid=status.id icon_with_text="arrow-up" %}
{% include 'snippets/toggle/close_button.html' %}
{% endwith %}
{% endif %}
2021-04-20 18:06:14 +00:00
</div>
</article>
</div>
2021-04-20 16:54:02 +00:00
</div>
{% endwith %}