2016-09-15 13:18:14 +00:00
|
|
|
{% if grav.twig.enable_comments_plugin %}
|
2017-05-11 17:42:43 +00:00
|
|
|
{% set scope = scope ?: 'data.' %}
|
2015-10-07 18:18:44 +00:00
|
|
|
|
2015-10-15 16:04:02 +00:00
|
|
|
<h3>{{'PLUGIN_COMMENTS.ADD_COMMENT'|t}}</h3>
|
2015-10-06 17:23:02 +00:00
|
|
|
|
2015-10-15 16:04:02 +00:00
|
|
|
<form name="{{ grav.config.plugins.comments.form.name }}"
|
2015-11-13 17:46:28 +00:00
|
|
|
action="{{ grav.config.plugins.comments.form.action ? base_url ~ grav.config.plugins.comments.form.action : page.url }}"
|
2015-10-15 16:04:02 +00:00
|
|
|
method="{{ grav.config.plugins.comments.form.method|upper|default('POST') }}">
|
2016-03-24 08:03:25 +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 %}
|
2016-07-19 10:04:17 +00:00
|
|
|
{% if config.plugins.login.enabled and grav.user.authenticated %}
|
2016-06-30 12:08:59 +00:00
|
|
|
{% if field.name == 'name' %}
|
2017-05-12 12:40:51 +00:00
|
|
|
<input type="hidden" name="{{ (scope ~ field.name)|fieldName }}" value="{{grav.user.fullname}}">
|
2016-06-30 12:08:59 +00:00
|
|
|
{% elseif field.name == 'email' %}
|
2017-05-12 12:40:51 +00:00
|
|
|
<input type="hidden" name="{{ (scope ~ field.name)|fieldName }}" value="{{grav.user.email}}">
|
2016-06-30 12:08:59 +00:00
|
|
|
{% else %}
|
|
|
|
<div>
|
|
|
|
{% include "forms/fields/#{field.type}/#{field.type}.html.twig" %}
|
2016-09-15 13:18:14 +00:00
|
|
|
</div>
|
2016-06-30 12:08:59 +00:00
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
|
|
<div>
|
|
|
|
{% include "forms/fields/#{field.type}/#{field.type}.html.twig" %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2016-03-24 08:03:25 +00:00
|
|
|
{% endfor %}
|
2016-09-15 13:18:14 +00:00
|
|
|
{% include "forms/fields/formname/formname.html.twig" %}
|
2015-10-06 17:23:02 +00:00
|
|
|
|
2015-10-15 16:04:02 +00:00
|
|
|
<div class="buttons">
|
|
|
|
{% for button in grav.config.plugins.comments.form.buttons %}
|
2016-03-24 08:03:25 +00:00
|
|
|
<button class="button" type="{{ button.type|default('submit') }}">{{ button.value|t|default('Submit') }}</button>
|
2015-10-15 16:04:02 +00:00
|
|
|
{% endfor %}
|
|
|
|
</div>
|
2015-11-10 15:25:18 +00:00
|
|
|
|
2017-01-09 09:12:23 +00:00
|
|
|
{{ nonce_field('form', 'form-nonce')|raw }}
|
2015-10-15 16:04:02 +00:00
|
|
|
</form>
|
|
|
|
|
|
|
|
<div class="alert">{{ form.message }}</div>
|
2015-10-13 21:39:13 +00:00
|
|
|
|
2015-10-15 16:04:02 +00:00
|
|
|
{% if grav.twig.comments|length %}
|
2015-10-07 14:23:32 +00:00
|
|
|
|
2015-10-15 16:04:02 +00:00
|
|
|
<h3>{{'PLUGIN_COMMENTS.COMMENTS'|t}}</h3>
|
2015-10-07 14:23:32 +00:00
|
|
|
|
2015-10-15 16:04:02 +00:00
|
|
|
<table>
|
|
|
|
{% for comment in grav.twig.comments|array_reverse %}
|
|
|
|
<tr>
|
|
|
|
<td>
|
2015-12-11 11:19:55 +00:00
|
|
|
{{comment.text}}
|
2015-10-15 16:04:02 +00:00
|
|
|
<br />
|
2015-12-11 11:19:55 +00:00
|
|
|
{{'PLUGIN_COMMENTS.WRITTEN_ON'|t}} {{comment.date|e}} {{'PLUGIN_COMMENTS.BY'|t}} {{comment.author}}
|
2015-10-15 16:04:02 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</table>
|
|
|
|
{% endif %}
|
2015-11-13 17:46:28 +00:00
|
|
|
{% endif %}
|