2016-09-15 13:18:14 +00:00
|
|
|
{% if grav.twig.enable_comments_plugin %}
|
2018-06-30 00:06:21 +00:00
|
|
|
{% set scope = scope ?: 'data.' %}
|
2015-10-07 18:18:44 +00:00
|
|
|
|
2018-06-30 00:06:21 +00:00
|
|
|
{% if grav.twig.pingbacks_enabled %}
|
|
|
|
{% if grav.twig.pingbacks|length %}
|
|
|
|
{% set comments_visible = false %}
|
|
|
|
{% for pingback in grav.twig.pingbacks %}
|
|
|
|
{% if pingback.approved == "true" %}
|
|
|
|
{% set comments_visible = true %}
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
2015-10-06 17:23:02 +00:00
|
|
|
|
2018-06-30 00:06:21 +00:00
|
|
|
{% if comments_visible %}
|
|
|
|
<h3>{{'PLUGIN_COMMENTS.COMMENTS_PINGBACKS'|t}}</h3>
|
2016-03-24 08:03:25 +00:00
|
|
|
|
2018-06-30 00:06:21 +00:00
|
|
|
<table>
|
|
|
|
{% for pingback in grav.twig.pingbacks %}
|
|
|
|
{% if pingback.approved == "true" %}
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<article id="pingback-{{loop.index0}}" class="pingback" itemtype="http://schema.org/UserComments">
|
|
|
|
<header class="pingback-meta">
|
|
|
|
<span class="pingback-author" itemprop="author" itemscope itemtype="http://schema.org/Person">
|
|
|
|
{{'PLUGIN_COMMENTS.BY'|t}}
|
|
|
|
<span itemprop="name">
|
|
|
|
{% if pingback.site %}
|
|
|
|
<a href="{{pingback.site}}">{{pingback.author}}</a>
|
|
|
|
{% else %}
|
|
|
|
{{pingback.author}}
|
|
|
|
{% endif %}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
<a href="{{uri.url(true)}}#pingback-{{loop.index0}}" title="Link to this pingback" itemprop="url">
|
|
|
|
<time class="pingback-date" datetime="{{pingback.date|e}}" itemprop="commentTime">
|
|
|
|
{{pingback.date|nicetime(false)}}
|
|
|
|
</time>
|
|
|
|
</a>
|
|
|
|
</header>
|
|
|
|
<div class="pingback-content" itemprop="commentText">
|
|
|
|
{{pingback.text}}
|
|
|
|
</div>
|
|
|
|
</article>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
</table
|
|
|
|
{% endif %}
|
|
|
|
</table>
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
2017-12-02 01:53:07 +00:00
|
|
|
|
2018-06-30 00:06:21 +00:00
|
|
|
{% if grav.twig.commenting_enabled %}
|
|
|
|
<h3>{{'PLUGIN_COMMENTS.ADD_COMMENT'|t}}</h3>
|
2017-12-02 01:53:07 +00:00
|
|
|
|
2018-06-30 00:06:21 +00:00
|
|
|
<form name="{{ grav.config.plugins.comments.form.name }}"
|
|
|
|
action="{{ grav.config.plugins.comments.form.action ? base_url ~ grav.config.plugins.comments.form.action : page.url }}"
|
|
|
|
method="{{ grav.config.plugins.comments.form.method|upper|default('POST') }}">
|
2017-12-02 01:53:07 +00:00
|
|
|
|
2018-06-30 00:06:21 +00:00
|
|
|
{% for field in grav.config.plugins.comments.form.fields %}
|
|
|
|
{% set value = form.value(field.name) %}
|
|
|
|
{% if field.evaluateDefault %}
|
|
|
|
{% set value = evaluate(field.evaluateDefault) %}
|
|
|
|
{% endif %}
|
|
|
|
{% if config.plugins.login.enabled and grav.user.authenticated %}
|
|
|
|
{% if field.name == 'name' %}
|
|
|
|
<input type="hidden" name="{{ (scope ~ field.name)|fieldName }}" value="{{grav.user.fullname}}">
|
|
|
|
{% elseif field.name == 'email' %}
|
|
|
|
<input type="hidden" name="{{ (scope ~ field.name)|fieldName }}" value="{{grav.user.email}}">
|
|
|
|
{% else %}
|
|
|
|
<div>
|
|
|
|
{% include "forms/fields/#{field.type}/#{field.type}.html.twig" %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
|
|
<div>
|
|
|
|
{% include "forms/fields/#{field.type}/#{field.type}.html.twig" %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% include "forms/fields/formname/formname.html.twig" %}
|
2015-10-06 17:23:02 +00:00
|
|
|
|
2018-06-30 00:06:21 +00:00
|
|
|
<div class="buttons">
|
|
|
|
{% for button in grav.config.plugins.comments.form.buttons %}
|
|
|
|
<button class="button" type="{{ button.type|default('submit') }}">{{ button.value|t|default('Submit') }}</button>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
2015-11-10 15:25:18 +00:00
|
|
|
|
2018-06-30 00:06:21 +00:00
|
|
|
{{ nonce_field('form', 'form-nonce')|raw }}
|
|
|
|
</form>
|
2015-10-15 16:04:02 +00:00
|
|
|
|
2018-06-30 00:06:21 +00:00
|
|
|
<div class="alert">{{ form.message }}</div>
|
|
|
|
{% endif %}
|
2015-10-13 21:39:13 +00:00
|
|
|
|
2018-06-30 00:06:21 +00:00
|
|
|
{% if grav.twig.comments|length %}
|
2015-10-07 14:23:32 +00:00
|
|
|
|
2018-06-30 00:06:21 +00:00
|
|
|
<h3>{{'PLUGIN_COMMENTS.COMMENTS'|t}}</h3>
|
2015-10-07 14:23:32 +00:00
|
|
|
|
2018-06-30 00:06:21 +00:00
|
|
|
<table class="comments">
|
|
|
|
{% set comments_visible = false %}
|
|
|
|
{% for comment in grav.twig.comments %}
|
|
|
|
{% if comment.approved == "true" %}
|
|
|
|
{% set comments_visible = true %}
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<article id="comment-{{loop.index0}}" class="comment" itemtype="http://schema.org/UserComments">
|
|
|
|
<header class="comment-meta">
|
|
|
|
<span class="comment-author" itemprop="author" itemscope itemtype="http://schema.org/Person">
|
|
|
|
<img class="comment-avatar" itemprop="image" src="https://www.gravatar.com/avatar/{{comment.email|ltrim()|rtrim()|md5}}?size=30&d=identicon">
|
|
|
|
{{'PLUGIN_COMMENTS.BY'|t}}
|
|
|
|
<span itemprop="name">
|
|
|
|
{% if comment.site %}
|
|
|
|
<a href="{{comment.site}}">{{comment.author}}</a>
|
|
|
|
{% else %}
|
|
|
|
{{comment.author}}
|
|
|
|
{% endif %}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
<a href="{{uri.url(true)}}#comment-{{loop.index0}}" title="Link to this comment" itemprop="url">
|
|
|
|
<time class="comment-date" datetime="{{comment.date|e}}" itemprop="commentTime">
|
|
|
|
{{comment.date|nicetime(false)}}
|
|
|
|
</time>
|
|
|
|
</a>
|
|
|
|
</header>
|
|
|
|
<div class="comment-content" itemprop="commentText">
|
|
|
|
{{comment.text}}
|
|
|
|
</div>
|
|
|
|
</article>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
2017-12-02 01:53:07 +00:00
|
|
|
|
2018-06-30 00:06:21 +00:00
|
|
|
{% if not comments_visible %}
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
{{'PLUGIN_COMMENTS.COMMENTS_NONE'|t}}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endif %}
|
|
|
|
</table>
|
|
|
|
{% endif %}
|
2015-11-13 17:46:28 +00:00
|
|
|
{% endif %}
|