forked from mirrors/bookwyrm
Show book preview in full statuses on mobile
This commit is contained in:
parent
7be456836d
commit
bb44ede2e7
2 changed files with 11 additions and 138 deletions
|
@ -14,10 +14,17 @@
|
|||
{% if not hide_book %}
|
||||
{% with book=status.book|default:status.mention_books.first %}
|
||||
{% if book %}
|
||||
<div class="column is-narrow is-hidden-mobile">
|
||||
<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/shelve_button/shelve_button.html' with book=book %}
|
||||
<div class="column is-narrow">
|
||||
<div class="columns is-mobile">
|
||||
<div class="column is-narrow">
|
||||
<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/shelve_button/shelve_button.html' with book=book %}
|
||||
</div>
|
||||
<div class="column is-hidden-tablet">
|
||||
<p>{{ book|book_description|to_markdown|default:""|safe|truncatewords_html:15 }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
|
|
@ -1,134 +0,0 @@
|
|||
{% load bookwyrm_tags %}
|
||||
{% load i18n %}
|
||||
|
||||
{% with status_type=status.status_type %}
|
||||
<div
|
||||
class="block"
|
||||
|
||||
{% if status_type == 'Review' %}
|
||||
{% firstof "reviewBody" as body_prop %}
|
||||
{% firstof 'itemprop="reviewRating" itemscope itemtype="https://schema.org/Rating"' as rating_type %}
|
||||
{% endif %}
|
||||
|
||||
{% if status_type == 'Rating' %}
|
||||
itemprop="rating"
|
||||
itemtype="https://schema.org/Rating"
|
||||
{% endif %}
|
||||
>
|
||||
{% if status_type == 'Review' or status_type == 'Rating' %}
|
||||
<div>
|
||||
{% if status.name %}
|
||||
<h3
|
||||
class="title is-5 has-subtitle"
|
||||
dir="auto"
|
||||
itemprop="name"
|
||||
>
|
||||
{{ status.name|escape }}
|
||||
</h3>
|
||||
{% endif %}
|
||||
|
||||
<span
|
||||
class="is-sr-only"
|
||||
{{ rating_type }}
|
||||
>
|
||||
<meta itemprop="ratingValue" content="{{ status.rating|floatformat }}">
|
||||
|
||||
{% if status_type == 'Rating' %}
|
||||
{# @todo Is it possible to not hard-code the value? #}
|
||||
<meta itemprop="bestRating" content="5">
|
||||
{% endif %}
|
||||
</span>
|
||||
|
||||
{% include 'snippets/stars.html' with rating=status.rating %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if status.content_warning %}
|
||||
<div>
|
||||
<p>{{ status.content_warning }}</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>
|
||||
{% 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 %}
|
||||
|
||||
{% if status.quote %}
|
||||
<div class="quote block">
|
||||
<blockquote dir="auto" class="content mb-2">{{ status.quote | safe }}</blockquote>
|
||||
|
||||
<p> — {% include 'snippets/book_titleby.html' with book=status.book %}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if status.content and status_type != 'GeneratedNote' and status_type != 'Announce' %}
|
||||
{% with full=status.content|safe no_trim=status.content_warning itemprop=body_prop %}
|
||||
{% 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>
|
||||
</div>
|
||||
|
||||
{% if not hide_book %}
|
||||
{% if status.book or status.mention_books.count %}
|
||||
<div
|
||||
{% if status_type != 'GeneratedNote' %}
|
||||
class="box has-background-white-bis"
|
||||
{% endif %}
|
||||
>
|
||||
{% if status.book %}
|
||||
{% with book=status.book %}
|
||||
{% include 'snippets/status/book_preview.html' %}
|
||||
{% endwith %}
|
||||
{% elif status.mention_books.count %}
|
||||
{% with book=status.mention_books.first %}
|
||||
{% include 'snippets/status/book_preview.html' %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
Loading…
Reference in a new issue