NDOJ/templates/comments/content-list.html

134 lines
6.5 KiB
HTML
Raw Normal View History

2023-05-22 13:52:18 +00:00
{% for node in mptt_tree(comment_list) recursive %}
2023-12-06 02:01:23 +00:00
<li id="comment-{{ node.id }}" data-revision="{{ node.revision_count - 1 }}" data-max-revision="{{ node.revision_count - 1 }}"
2023-07-26 16:52:34 +00:00
data-revision-ajax="{{ url('comment_revision_ajax', node.id) }}" class="comment">
<div class="comment-display{% if node.score <= vote_hide_threshold %} bad-comment{% endif %}">
<div class="info">
<div class="vote">
2023-09-28 23:23:39 +00:00
{% if profile %}
2023-07-26 16:52:34 +00:00
<a href="javascript:comment_upvote({{ node.id }})"
class="upvote-link fa fa-chevron-up fa-fw{% if node.vote_score == 1 %} voted{% endif %}"></a>
2023-05-22 16:11:40 +00:00
{% else %}
2023-07-26 16:52:34 +00:00
<a href="javascript:alert('{{ _('Please login to vote')|escapejs }}')"
title="{{ _('Please login to vote') }}" class="upvote-link fa fa-chevron-up fa-fw"></a>
{% endif %}
<br>
<div class="comment-score">{{ node.score }}</div>
2023-09-28 23:23:39 +00:00
{% if profile %}
2023-07-26 16:52:34 +00:00
<a href="javascript:comment_downvote({{ node.id }})"
class="downvote-link fa fa-chevron-down fa-fw{% if node.vote_score == -1 %} voted{% endif %}"></a>
{% else %}
<a href="javascript:alert('{{ _('Please login to vote')|escapejs }}')"
title="{{ _('Please login to vote') }}" class="downvote-link fa fa-chevron-down fa-fw"></a>
{% endif %}
</div>
2023-05-22 16:11:40 +00:00
</div>
2023-07-26 16:52:34 +00:00
<div class="detail">
<div class="header">
2024-04-13 22:19:39 +00:00
{{ link_user(node.author, show_image=True) }}&nbsp;&nbsp;
2023-07-26 16:52:34 +00:00
{{ relative_time(node.time, abs=_('{time}'), rel=_('{time}')) }}
<span class="comment-spacer"></span>
<span class="comment-operation">
2023-12-06 02:01:23 +00:00
{% if node.revision_count > 1 %}
2023-07-26 16:52:34 +00:00
<span class="comment-edits">
<a href="javascript:show_revision({{ node.id }}, -1)" class="previous-revision">&larr;</a>
<span class="comment-edit-text">
2023-12-06 02:01:23 +00:00
{% if node.revision_count > 2 %}
{% trans edits=node.revision_count - 1 %}edit {{ edits }}{% endtrans %}
2023-07-26 16:52:34 +00:00
{% else %}
{{ _('edited') }}
{% endif %}
</span>
<a href="javascript:show_revision({{ node.id }}, 1)" style="visibility: hidden"
class="next-revision">&rarr;</a>
2023-05-22 16:11:40 +00:00
</span>
{% else %}
<span class="comment-edits"></span>
{% endif %}
<a href="?comment-id={{node.id}}#comment-{{ node.id }}" title="{{ _('Link') }}" class="comment-link">
<i class="fa fa-link fa-fw"></i>
</a>
2023-09-28 23:23:39 +00:00
{% if profile and not comment_lock %}
2023-05-22 16:11:40 +00:00
{% set can_edit = node.author.id == profile.id and not profile.mute %}
{% if can_edit %}
2023-12-06 02:01:23 +00:00
<a data-featherlight="{{ url('comment_edit_ajax', node.id) }}" href="#" title="{{ _('Edit') }}" class="edit-link">
2023-05-22 16:11:40 +00:00
<i class="fa fa-pencil fa-fw"></i>
2023-05-22 13:52:18 +00:00
</a>
2023-05-22 16:11:40 +00:00
{% else %}
2023-07-26 16:52:34 +00:00
<a href="javascript:reply_comment({{ node.id }})" title="{{ _('Reply') }}">
<i class="fa fa-reply fa-fw"></i>
</a>
2023-05-22 16:11:40 +00:00
{% endif %}
2023-07-26 16:52:34 +00:00
{% if perms.judge.change_comment %}
{% if can_edit %}
<a href="javascript:reply_comment({{ node.id }})" title="{{ _('Reply') }}"><i
class="fa fa-reply fa-fw"></i></a>
{% else %}
2023-12-06 02:01:23 +00:00
<a data-featherlight="{{ url('comment_edit_ajax', node.id) }}" href="#" title="{{ _('Edit') }}" class="edit-link">
<i class="fa fa-pencil fa-fw"></i>
</a>
2023-07-26 16:52:34 +00:00
{% endif %}
<a href="javascript:" title="{{ _('Hide') }}" data-id="{{ node.id }}" class="hide-comment"><i
2023-05-22 16:11:40 +00:00
class="fa fa-trash fa-fw"></i></a>
2023-07-26 16:52:34 +00:00
<a href="{{ url('admin:judge_comment_change', node.id) }}" title="{{ _('Admin') }}"><i
2023-05-22 16:11:40 +00:00
class="fa fa-cog fa-fw"></i></a>
2023-07-26 16:52:34 +00:00
{% endif %}
2023-05-22 13:52:18 +00:00
{% endif %}
2023-07-26 16:52:34 +00:00
</span>
2023-05-22 13:52:18 +00:00
</div>
2023-07-26 16:52:34 +00:00
<div class="content content-description">
<div class="comment-body" {% if node.score <=vote_hide_threshold %} style="display:none" {% endif %}>
{{ node.body|markdown(lazy_load=True)|reference|str|safe }}
2023-05-22 16:11:40 +00:00
</div>
2023-07-26 16:52:34 +00:00
{% if node.score <= vote_hide_threshold %}
<div class="comment-body bad-comment-body">
<p>
{% trans id=node.id %}This comment is hidden due to too much negative feedback. Click <a
href="javascript:comment_show_content({{ id }})">here</a> to view it.{% endtrans %}
</p>
</div>
{% endif %}
</div>
2023-05-22 16:11:40 +00:00
</div>
2023-05-22 13:52:18 +00:00
</div>
2023-07-26 16:52:34 +00:00
{% set count_replies=node.count_replies %}
{% if count_replies %}
<a href="javascript:comment_get_replies({{ node.id }}, 0)" class="show_more_reply">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-arrow-forward" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M15 11l4 4l-4 4m4 -4h-11a4 4 0 0 1 0 -8h1"></path>
</svg>
{{ count_replies }}
{% trans trimmed count=count_replies %}
reply
{% pluralize count %}
replies
{% endtrans %}
</a>
{% endif %}
</li>
<ul id="comment-{{ node.id }}-reply" class="reply-comment" hidden></ul>
2023-05-22 16:11:40 +00:00
{% with children=node.get_children() %}
{% if children %}
<ul id="comment-{{ node.id }}-children" class="comments">{{ loop(children) }}</ul>
{% else %}
<ul id="comment-{{ node.id }}-children" class="comments"></ul>
{% endif %}
{% endwith %}
2023-05-22 13:52:18 +00:00
{% endfor %}
2023-05-22 16:11:40 +00:00
{% if comment_more > 0 %}
<a href="javascript:comment_show_more({{ comment_root_id }}, {{ comment_parent_none }}, {{ offset }}, {{ target_comment }})" class="show_more_comment">
2023-05-22 13:52:18 +00:00
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-down" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
2023-05-22 16:11:40 +00:00
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M6 9l6 6l6 -6"></path>
2023-07-26 16:52:34 +00:00
</svg>
{{ comment_more }}
{% trans trimmed count=comment_more %}
more comment
{% pluralize count %}
more comments
{% endtrans %}
2023-05-22 16:11:40 +00:00
</a>
2023-05-22 13:52:18 +00:00
{% endif %}