47 lines
1.6 KiB
Twig
47 lines
1.6 KiB
Twig
{% if grav.twig.enable %}
|
|
|
|
<h3>{{'PLUGIN_COMMENTS.ADD_COMMENT'|t}}</h3>
|
|
|
|
<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') }}">
|
|
{% for field in grav.config.plugins.comments.form.fields %}
|
|
|
|
{% set value = form.value(field.name) %}
|
|
{% if field.evaluateDefault %}
|
|
{% set value = evaluate(field.evaluateDefault) %}
|
|
{% endif %}
|
|
<div>
|
|
{% include "forms/fields/#{field.type}/#{field.type}.html.twig" %}
|
|
</div>
|
|
{% endfor %}
|
|
|
|
<div class="buttons">
|
|
{% for button in grav.config.plugins.comments.form.buttons %}
|
|
<button class="button" type="{{ button.type|default('submit') }}">{{ button.value|default('Submit') }}</button>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{{ nonce_field('form', 'form-nonce') }}
|
|
</form>
|
|
|
|
<div class="alert">{{ form.message }}</div>
|
|
|
|
{% if grav.twig.comments|length %}
|
|
|
|
<h3>{{'PLUGIN_COMMENTS.COMMENTS'|t}}</h3>
|
|
|
|
<table>
|
|
{% for comment in grav.twig.comments|array_reverse %}
|
|
<tr>
|
|
<td>
|
|
{{comment.text}}
|
|
<br />
|
|
{{'PLUGIN_COMMENTS.WRITTEN_ON'|t}} {{comment.date|e}} {{'PLUGIN_COMMENTS.BY'|t}} {{comment.author}}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</table>
|
|
{% endif %}
|
|
{% endif %}
|