moviewyrm/bookwyrm/templates/snippets/trimmed_text.html

54 lines
2.2 KiB
HTML
Raw Normal View History

2021-05-11 22:14:42 +00:00
{% load markdown %}
2021-05-11 21:41:28 +00:00
{% load utilities %}
{% load i18n %}
2020-11-12 19:40:20 +00:00
{% with 0|uuid as uuid %}
2021-08-07 22:51:53 +00:00
{% firstof trim_length 150 as trim_length %}
2021-04-09 21:57:49 +00:00
{% if full %}
{% with full|to_markdown|safe as full %}
2021-08-07 22:51:53 +00:00
{% with full|to_markdown|safe|truncatewords_html:trim_length as trimmed %}
2021-04-09 21:57:49 +00:00
{% if not no_trim and trimmed != full %}
<div id="hide_full_{{ uuid }}">
<div class="content" id="trimmed_{{ uuid }}">
2021-04-09 21:57:49 +00:00
<div dir="auto">{{ trimmed }}</div>
2020-11-12 19:40:20 +00:00
2021-04-09 21:57:49 +00:00
<div>
2021-08-07 22:51:53 +00:00
{% if not hide_more %}
2021-04-09 21:57:49 +00:00
{% trans "Show more" as button_text %}
{% include 'snippets/toggle/open_button.html' with text=button_text controls_text="full" controls_uid=uuid class="is-small" %}
2021-08-07 22:51:53 +00:00
{% endif %}
2021-04-09 21:57:49 +00:00
</div>
</div>
</div>
2021-08-07 22:51:53 +00:00
{% if not hide_more %}
<div id="full_{{ uuid }}" class="is-hidden">
2021-04-09 21:57:49 +00:00
<div class="content">
<div
dir="auto"
{% if itemprop %}itemprop="{{ itemprop }}{% endif %}"
>
{{ full }}
</div>
2020-11-12 19:40:20 +00:00
2021-04-09 21:57:49 +00:00
<div>
{% trans "Show less" as button_text %}
{% include 'snippets/toggle/close_button.html' with text=button_text controls_text="full" controls_uid=uuid class="is-small" %}
</div>
</div>
</div>
2021-08-07 22:51:53 +00:00
{% endif %}
2021-04-10 17:57:23 +00:00
{% else %}
2021-04-09 21:57:49 +00:00
<div class="content">
<div
dir="auto"
{% if itemprop %}itemprop="{{ itemprop }}{% endif %}"
>
{{ full }}
</div>
</div>
{% endif %}
{% endwith %}
{% endwith %}
{% endif %}
2021-01-31 16:41:11 +00:00
{% endwith %}