Browse Source

Hide topic text excerpt for spoilers

merge-requests/22/head
Ivan Fonseca 6 years ago
committed by Deimos
parent
commit
35ea0f43b4
  1. 10
      tildes/tildes/templates/macros/topics.jinja2

10
tildes/tildes/templates/macros/topics.jinja2

@ -47,6 +47,15 @@
</div> </div>
{% if topic.is_text_type and topic.get_content_metadata('excerpt') %} {% if topic.is_text_type and topic.get_content_metadata('excerpt') %}
{# warn about spoilers #}
{% if 'spoiler' in topic.tags %}
<details class="topic-text-excerpt">
<summary>
<span>Warning: this post may contain spoilers.</span>
</summary>
{{ topic.rendered_html|safe }}
</details>
{% else %}
{# if the "excerpt" is the full text, don't wrap in <details> #} {# if the "excerpt" is the full text, don't wrap in <details> #}
{% if not topic.get_content_metadata('excerpt').endswith('...') %} {% if not topic.get_content_metadata('excerpt').endswith('...') %}
<p class="topic-text-excerpt">{{ topic.get_content_metadata('excerpt') }}</p> <p class="topic-text-excerpt">{{ topic.get_content_metadata('excerpt') }}</p>
@ -63,6 +72,7 @@
</details> </details>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endif %}
<footer class="topic-info"> <footer class="topic-info">
<div class="topic-info-comments"> <div class="topic-info-comments">

Loading…
Cancel
Save