moviewyrm/bookwyrm/templates/snippets/trimmed_text.html
2021-01-17 10:38:34 -08:00

24 lines
900 B
HTML

{% load bookwyrm_tags %}
{% with 0|uuid as uuid %}
{% if full %}
{% with full|truncatewords_html:60 as trimmed %}
{% if trimmed != full %}
<div id="hide-full-{{ uuid }}">
<blockquote class="content" id="trimmed-{{ uuid }}"><span dir="auto">{{ trimmed | to_markdown | safe }}</span>
{% include 'snippets/toggle/open_button.html' with text="show more" controls_text="full" controls_uid=uuid class="is-small" %}
</blockquote>
</div>
<div id="full-{{ uuid }}" class="hidden">
<blockquote class="content"><span dir="auto">{{ full | to_markdown | safe }}</span>
{% include 'snippets/toggle/close_button.html' with text="show less" controls_text="full" controls_uid=uuid class="is-small" %}
</blockquote>
</div>
{% else %}
<blockquote class="content"><span dir="auto">{{ full | to_markdown | safe }}</span></blockquote>
{% endif %}
{% endwith %}
{% endif %}
{% endwith %}