|
|
@ -47,31 +47,7 @@ |
|
|
|
</div> |
|
|
|
|
|
|
|
{% 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 not topic.get_content_metadata('excerpt').endswith('...') %} |
|
|
|
<p class="topic-text-excerpt">{{ topic.get_content_metadata('excerpt') }}</p> |
|
|
|
{% else %} |
|
|
|
<details class="topic-text-excerpt" |
|
|
|
{% if request.user and request.user.open_new_tab_text %} |
|
|
|
data-js-external-links-new-tabs |
|
|
|
{% endif %} |
|
|
|
> |
|
|
|
<summary> |
|
|
|
<span>{{ topic.get_content_metadata('excerpt') }}</span> |
|
|
|
</summary> |
|
|
|
{{ topic.rendered_html|safe }} |
|
|
|
</details> |
|
|
|
{% endif %} |
|
|
|
{% endif %} |
|
|
|
{{ topic_excerpt_expandable(topic) }} |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
<footer class="topic-info"> |
|
|
@ -104,6 +80,31 @@ |
|
|
|
</article> |
|
|
|
{% endmacro %} |
|
|
|
|
|
|
|
{% macro topic_excerpt_expandable(topic) %} |
|
|
|
{% if topic.is_spoiler %} |
|
|
|
{% set excerpt = 'Warning: this post may contain spoilers' %} |
|
|
|
{% set is_expandable = True %} |
|
|
|
{% else %} |
|
|
|
{% set excerpt = topic.get_content_metadata('excerpt') %} |
|
|
|
|
|
|
|
{# if the excerpt is the full text, it doesn't need to be expandable #} |
|
|
|
{% set is_expandable = excerpt.endswith('...') %} |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
{% if is_expandable %} |
|
|
|
<details class="topic-text-excerpt" |
|
|
|
{% if request.user and request.user.open_new_tab_text %} |
|
|
|
data-js-external-links-new-tabs |
|
|
|
{% endif %} |
|
|
|
> |
|
|
|
<summary><span>{{ excerpt }}</span></summary> |
|
|
|
{{ topic.rendered_html|safe }} |
|
|
|
</details> |
|
|
|
{% else %} |
|
|
|
<p class="topic-text-excerpt">{{ topic.get_content_metadata('excerpt') }}</p> |
|
|
|
{% endif %} |
|
|
|
{% endmacro %} |
|
|
|
|
|
|
|
{% macro topic_voting(topic) %} |
|
|
|
{% if request.has_permission('vote', topic) %} |
|
|
|
{% if topic.user_voted %} |
|
|
|