+ ajax-delete comments via front end (if logged in with super admin priviledges)

This commit is contained in:
Thorsten Witteler 2017-10-25 02:58:07 +02:00
parent b4ab9a5111
commit 905c04937c
5 changed files with 278 additions and 43 deletions

View file

@ -1,5 +1,4 @@
<h3>{{'PLUGIN_COMMENTS.ADD_COMMENT'|t}}</h3>
<form name="{{ grav.config.plugins.comments.form.name }}" class="comments-form"
<form id="comments-form" name="{{ grav.config.plugins.comments.form.name }}" class="comments-form"
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') }}">
@ -35,4 +34,4 @@
{{ nonce_field('comments', 'form-nonce')|raw }}
</form>
<div class="alert">{{ form.message }}</div>
<div id="comments-alert" class="alert">{{ form.message }}</div>

View file

@ -1,27 +1,27 @@
{% if grav.twig.enable_comments_plugin %}
{% set scope = scope ?: 'data.' %}
<section id="comments-section">
<h2>{{'PLUGIN_COMMENTS.COMMENTS'|t}}</h3>
<!-- <h2>{{ 'COMMENTS'|t }}</h2> -->
{% include 'partials/comments.form.html.twig' %}
{% if grav.twig.comments|length %}
<h3>{{'PLUGIN_COMMENTS.COMMENTS'|t}}</h3>
<a class="comment-add-new" href="#"><i class="fa fa-plus" title="{{'PLUGIN_COMMENTS.ADD_NEW'|t}}"></i> {{'PLUGIN_COMMENTS.ADD_NEW'|t}}</a>
<div class="row comments">
{% for comment in grav.twig.comments %}
<div class="comment comment-level-{{comment.level|e}}" data-level="{{comment.level}}" data-id="{{comment.id}}" >
<div class="comment-left">
<a href="#">
<img class="comment-object" src="https://www.gravatar.com/avatar/{{comment.email|trim|lower|md5}}?d=identicon" alt="user icon">
</a>
</div>
<div class="comment-body">
<div class="comment-heading">
<div class="comment-title"><h4>{{comment.title}}</h4></div>
<div class="comment-reply">
<a class="comment-add-reply" href="#"><i class="fa fa-reply" title="{{'PLUGIN_COMMENTS.ADD_REPLY'|t}}"></i> {{'PLUGIN_COMMENTS.ADD_REPLY'|t}}</a>
<a class="comment-add-reply" href="#"><i class="fa fa-reply" title="{{'PLUGIN_COMMENTS.ADD_REPLY'|t}}"></i> {{'PLUGIN_COMMENTS.REPLY'|t}}</a>
{% if grav.user.access.admin.super %}
<a class="comment-delete" href="#"><i class="fa fa-trash" title="{{'PLUGIN_COMMENTS.DELETE'|t}}"></i> {{'PLUGIN_COMMENTS.DELETE'|t}}</a>
<a class="comment-delete" href="#"><i class="fa fa-trash" title="{{'PLUGIN_COMMENTS.DELETE_COMMENT'|t}}"></i> {{'PLUGIN_COMMENTS.DELETE'|t}}</a>
{% endif %}
</div>
<div class="comment-meta">{{'PLUGIN_COMMENTS.WRITTEN_ON'|t}} {{comment.date|e}} {{'PLUGIN_COMMENTS.BY'|t}} {{comment.author}}</div>
@ -36,6 +36,7 @@
</div>
{% endif %}
</section>
{% endif %}