grav-plugin-comments/templates/partials/comments.html.twig

76 lines
2.8 KiB
Twig

{% if grav.twig.enable_comments_plugin %}
{% set scope = scope ?: 'data.' %}
<section id="comments-section">
<h2>{{'PLUGIN_COMMENTS.COMMENTS'|t}}</h2>
{% if grav.twig.commenting_enabled %}
<a class="comment-add-new" href="#"><i class="fa fa-plus" title="{{'PLUGIN_COMMENTS.ADD_NEW'|t}}"></i> {{'PLUGIN_COMMENTS.ADD_NEW'|t}}</a>
{% endif %}
{% include 'partials/comments.form.html.twig' %}
<div id="comments" class="row comments">
{% if grav.twig.comments|length %}
{% set comments_visible = false %}
{% for comment in grav.twig.comments %}
{% if comment.approved == "true" %}
<div class="comment-wrapper">
{% set comments_visible = true %}
{% for level in range(0, comment.level|e) %}
{% if level == comment.level|e %}
<div id="thread-{{level}}" class="comment-thread-top comment-thread">
</div>
{% else %}
<div id="thread-{{level}}" class="comment-thread">
</div>
{% endif %}
{% endfor %}
<div id="comment-{{comment.id}}" class="comment comment-level-{{comment.level|e}}" data-id="{{comment.id}}" itemtype="http://schema.org/UserComments">
<header class="comment-heading">
<img class="comment-avatar" src="https://www.gravatar.com/avatar/{{comment.email|trim|lower|md5}}?size=20&d=identicon" alt="user icon">
<span class="comment-meta">
{% if comment.site %}
<a href="{{comment.site}}">{{comment.author}}</a>
{% else %}
{{comment.author}}
{% endif %}
<a href="{{uri.url(true)}}#comment-{{comment.id}}" title="Link to this comment" itemprop="url">
<time class="comment-date" datetime="{{comment.date|e}}" itemprop="commentTime">
{{comment.date|nicetime(false)}}
</time>
</a>
</span>
</header>
<div class="comment-body">
<div class="comment-text" >
{{comment.text}}
</div>
{{nested}}
<div class="comment-footer">
<span class="comment-reply">
{% if grav.twig.commenting_enabled and comment.id %}
<a class="comment-add-reply" href="#"><i class="fa fa-reply" title="{{'PLUGIN_COMMENTS.ADD_REPLY'|t}}"></i> {{'PLUGIN_COMMENTS.REPLY'|t}}</a>
{% endif %}
{% if grav.user.access.admin.super %}
<a class="comment-delete" href="#"><i class="fa fa-trash" title="{{'PLUGIN_COMMENTS.DELETE_COMMENT'|t}}"></i> {{'PLUGIN_COMMENTS.DELETE'|t}}</a>
{% endif %}
</span>
</div>
</div>
</div>
</div>
{% endif %}
{% endfor %}
{% endif %}
{% if not comments_visible %}
<tr>
<td>
{{'PLUGIN_COMMENTS.COMMENTS_NONE'|t}}
</td>
</tr>
{% endif %}
</div>
</section>
{% endif %}