From 35ea0f43b48dbaad318998152d10a6b44d4488aa Mon Sep 17 00:00:00 2001 From: Ivan Fonseca Date: Wed, 1 Aug 2018 14:54:37 -0400 Subject: [PATCH] Hide topic text excerpt for spoilers --- tildes/tildes/templates/macros/topics.jinja2 | 30 +++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/tildes/tildes/templates/macros/topics.jinja2 b/tildes/tildes/templates/macros/topics.jinja2 index 5ad4112..4519847 100644 --- a/tildes/tildes/templates/macros/topics.jinja2 +++ b/tildes/tildes/templates/macros/topics.jinja2 @@ -47,20 +47,30 @@ {% if topic.is_text_type and topic.get_content_metadata('excerpt') %} - {# if the "excerpt" is the full text, don't wrap in
#} - {% if not topic.get_content_metadata('excerpt').endswith('...') %} -

{{ topic.get_content_metadata('excerpt') }}

- {% else %} -
+ {# warn about spoilers #} + {% if 'spoiler' in topic.tags %} +
- {{ topic.get_content_metadata('excerpt') }} + Warning: this post may contain spoilers. {{ topic.rendered_html|safe }}
+ {% else %} + {# if the "excerpt" is the full text, don't wrap in
#} + {% if not topic.get_content_metadata('excerpt').endswith('...') %} +

{{ topic.get_content_metadata('excerpt') }}

+ {% else %} +
+ + {{ topic.get_content_metadata('excerpt') }} + + {{ topic.rendered_html|safe }} +
+ {% endif %} {% endif %} {% endif %}