|
|
|
@ -4,48 +4,37 @@ |
|
|
|
{% from 'datetime.jinja2' import time_ago_responsive %} |
|
|
|
{% from 'links.jinja2' import username_linked %} |
|
|
|
|
|
|
|
{% macro render_single_comment(comment, is_new_topic=False) %} |
|
|
|
{{ render_comment_tree([comment], is_individual_comment=True, is_new_topic=is_new_topic) }} |
|
|
|
{% macro render_single_comment(comment) %} |
|
|
|
{{ render_comment_tree([comment], is_individual_comment=True) }} |
|
|
|
{% endmacro %} |
|
|
|
|
|
|
|
{% macro render_comment_tree(comments, mark_newer_than=None, is_individual_comment=False, is_new_topic=False) %} |
|
|
|
{% macro render_comment_tree(comments, mark_newer_than=None, is_individual_comment=False) %} |
|
|
|
{% if comments is defined and comments|length > 0 %} |
|
|
|
{# if this is a list of comments wrap in an ordered list #} |
|
|
|
{% if is_new_topic or not is_individual_comment %} |
|
|
|
<ol class="comment-replies"> |
|
|
|
{{ render_comments(comments, mark_newer_than, is_individual_comment) }} |
|
|
|
</ol> |
|
|
|
{% else %} |
|
|
|
{{ render_comments(comments, mark_newer_than, is_individual_comment) }} |
|
|
|
{% endif %} |
|
|
|
{% endif %} |
|
|
|
{% endmacro %} |
|
|
|
|
|
|
|
{% macro render_comments(comments, mark_newer_than=None, is_individual_comment=False) %} |
|
|
|
{% for comment in comments recursive %} |
|
|
|
<li class="comment-reply"><article id="comment-{{ comment.comment_id36 }}" |
|
|
|
class="{{ comment_classes(comment, mark_newer_than)|trim }}" |
|
|
|
data-comment-id36="{{ comment.comment_id36 }}" |
|
|
|
|
|
|
|
{# only add depth attr if we're rendering multiple comments at once #} |
|
|
|
{% if not is_individual_comment %} |
|
|
|
data-comment-depth="{{ loop.depth0 }}" |
|
|
|
{% endif %} |
|
|
|
{% for comment in comments recursive %} |
|
|
|
<li><article id="comment-{{ comment.comment_id36 }}" |
|
|
|
class="{{ comment_classes(comment, mark_newer_than)|trim }}" |
|
|
|
data-comment-id36="{{ comment.comment_id36 }}" |
|
|
|
|
|
|
|
{# only add depth attr if we're rendering multiple comments at once #} |
|
|
|
{% if not is_individual_comment %} |
|
|
|
data-comment-depth="{{ loop.depth0 }}" |
|
|
|
{% endif %} |
|
|
|
|
|
|
|
{% if request.has_permission("label", comment) %} |
|
|
|
data-comment-user-labels="{{ comment.labels_by_user(request.user)|join(' ') }}" |
|
|
|
{% endif %} |
|
|
|
> |
|
|
|
{{ render_comment_contents(comment, is_individual_comment) }} |
|
|
|
{% if request.has_permission("label", comment) %} |
|
|
|
data-comment-user-labels="{{ comment.labels_by_user(request.user)|join(' ') }}" |
|
|
|
{% endif %} |
|
|
|
> |
|
|
|
{{ render_comment_contents(comment, is_individual_comment) }} |
|
|
|
|
|
|
|
{% if comment.replies is defined and comment.replies %} |
|
|
|
<ol class="comment-replies"> |
|
|
|
{# Recursively display reply comments #} |
|
|
|
{{ loop(comment.replies) }} |
|
|
|
</ol> |
|
|
|
{% endif %} |
|
|
|
</article></li> |
|
|
|
{% endfor %} |
|
|
|
{% if comment.replies is defined and comment.replies %} |
|
|
|
<ol class="comment-replies"> |
|
|
|
{# Recursively display reply comments #} |
|
|
|
{{ loop(comment.replies) }} |
|
|
|
</ol> |
|
|
|
{% endif %} |
|
|
|
</article></li> |
|
|
|
{% endfor %} |
|
|
|
{% endif %} |
|
|
|
{% endmacro %} |
|
|
|
|
|
|
|
{% macro render_comment_contents(comment, is_individual_comment=False) %} |
|
|
|
|