2015-09-13 18:32:44 +00:00
|
|
|
{% extends 'partials/base.html.twig' %}
|
|
|
|
|
|
|
|
{% if admin.route %}
|
|
|
|
{% set context = admin.page(true) %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% block titlebar %}
|
2015-09-14 12:48:17 +00:00
|
|
|
<h1><i class="fa fa-fw fa-file-text-o"></i> {{ "PLUGIN_COMMENTS.COMMENTS"|tu }}</h1>
|
2015-09-13 18:32:44 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block content %}
|
2015-10-07 13:43:28 +00:00
|
|
|
<style>
|
|
|
|
td.comments-actions {
|
|
|
|
flex: 0.1;
|
|
|
|
}
|
2015-10-06 17:23:02 +00:00
|
|
|
|
2015-10-07 13:43:28 +00:00
|
|
|
.pages-list .row {
|
|
|
|
padding-right: 1rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.comment-text {
|
|
|
|
line-height: 1.5rem;
|
|
|
|
display: inline-block;
|
|
|
|
}
|
|
|
|
|
|
|
|
.pages-list .row p.page-route {
|
|
|
|
margin: 0px 0 10px 0px;
|
|
|
|
}
|
2015-10-07 21:53:36 +00:00
|
|
|
|
|
|
|
th { background: #d9d9d9; }
|
|
|
|
|
|
|
|
.comment { flex: 3 }
|
|
|
|
.details { flex: 1.5 }
|
|
|
|
|
|
|
|
.center {
|
|
|
|
margin: 0 auto;
|
|
|
|
text-align: center;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
.button:active { margin: 0 auto;}
|
2015-10-07 13:43:28 +00:00
|
|
|
</style>
|
|
|
|
|
|
|
|
<script>
|
2015-10-07 21:53:36 +00:00
|
|
|
$(function() {
|
|
|
|
var currentPage = 0;
|
|
|
|
|
|
|
|
$(document).on('click tap', '.js__load-more', function(event) {
|
|
|
|
$.getJSON(window.location + '/page:' + (currentPage + 1))
|
|
|
|
.success(function(response) {
|
|
|
|
currentPage = parseInt(response.page);
|
|
|
|
|
|
|
|
response.comments.forEach(function(comment) {
|
|
|
|
$('.js__comments-container').append('<tr>' +
|
|
|
|
'<td class="e author">' + comment.author + '</td>' +
|
|
|
|
'<td class="v comment">' + comment.text + '</td>' +
|
|
|
|
'<td class="v details"><strong>Page</strong>: ' + comment.pageTitle + '<br>' +
|
|
|
|
'<strong>Date</strong>: ' + comment.date + '</td>' +
|
|
|
|
'</tr>');
|
|
|
|
})
|
|
|
|
|
2015-10-08 15:30:18 +00:00
|
|
|
var totalRetrieved = response.totalRetrieved * (parseInt(response.page) + 1);
|
|
|
|
|
|
|
|
$('.totalRetrieved').html(totalRetrieved);
|
2015-10-07 21:53:36 +00:00
|
|
|
$('.totalAvailable').html(response.totalAvailable);
|
2015-10-08 15:30:18 +00:00
|
|
|
|
|
|
|
if (totalRetrieved == response.totalAvailable) {
|
|
|
|
$('.js__load-more').hide();
|
|
|
|
}
|
2015-10-07 21:53:36 +00:00
|
|
|
})
|
|
|
|
.error(function() {
|
|
|
|
alert('Unexpected error');
|
|
|
|
});
|
|
|
|
});
|
2015-10-07 13:43:28 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2017-12-06 01:03:12 +00:00
|
|
|
{% if grav.twig.warning_message|length %}
|
|
|
|
<div class="admin-block">
|
|
|
|
<h1>{{ "PLUGIN_COMMENTS.WARNINGS"|tu }}</h1>
|
|
|
|
<p class="center">{{ grav.twig.warning_message }}</p>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
2015-10-09 17:34:51 +00:00
|
|
|
<h1>Comments in the last 7 days</h1>
|
2015-10-07 13:43:28 +00:00
|
|
|
|
2015-10-09 17:34:51 +00:00
|
|
|
<div class="admin-block">
|
2015-10-07 21:53:36 +00:00
|
|
|
<table>
|
|
|
|
<tbody class="js__comments-container">
|
|
|
|
<tr class="h">
|
|
|
|
<th class="author">Author</th>
|
|
|
|
<th class="comment">Comment</th>
|
|
|
|
<th class="details">Details</th>
|
|
|
|
</tr>
|
|
|
|
{% for comment in grav.twig.comments.comments %}
|
|
|
|
<tr>
|
2015-10-09 17:34:51 +00:00
|
|
|
<td class="author">{{comment.author}}</td>
|
|
|
|
<td class="comment">{{comment.text}}</td>
|
|
|
|
<td class="details"><strong>Page</strong>: {{comment.pageTitle}}<br>
|
2015-10-07 21:53:36 +00:00
|
|
|
<strong>Date</strong>: {{comment.date}}</td>
|
|
|
|
</tr>
|
2015-10-06 17:23:02 +00:00
|
|
|
{% endfor %}
|
2015-10-07 21:53:36 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
2015-10-08 15:33:43 +00:00
|
|
|
{% if grav.twig.comments.totalRetrieved < grav.twig.comments.totalAvailable %}
|
|
|
|
<button type="button" class="button center js__load-more">
|
|
|
|
Load more
|
|
|
|
</button>
|
|
|
|
{% endif %}
|
2015-10-07 21:53:36 +00:00
|
|
|
|
|
|
|
<p class="center">Showing <span class="totalRetrieved">{{grav.twig.comments.totalRetrieved}}</span> comments of <span class="totalAvailable">{{grav.twig.comments.totalAvailable}}</span></p>
|
2015-09-13 18:32:44 +00:00
|
|
|
</div>
|
2015-10-07 13:43:28 +00:00
|
|
|
|
2015-10-18 09:12:28 +00:00
|
|
|
{% if grav.twig.pages %}
|
|
|
|
<h1>Recently commented pages</h1>
|
|
|
|
|
|
|
|
<div class="admin-block">
|
|
|
|
<table>
|
|
|
|
<tbody class="js__pages-container">
|
|
|
|
<tr class="h">
|
|
|
|
<th class="page">Page</th>
|
|
|
|
<th class="number-of-comments">Number of comments</th>
|
|
|
|
<th class="last-comment-date">Last commented on</th>
|
2015-10-13 21:39:13 +00:00
|
|
|
</tr>
|
2015-10-18 09:12:28 +00:00
|
|
|
{% for page in grav.twig.pages %}
|
|
|
|
<tr>
|
|
|
|
<td class="page">{{page.title}}</td>
|
|
|
|
<td class="number-of-comments">{{page.commentsCount}}</td>
|
|
|
|
<td class="last-comment-date">{{page.lastCommentDate}}</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2015-10-13 21:39:13 +00:00
|
|
|
|
2015-09-13 18:32:44 +00:00
|
|
|
{% endblock %}
|
2015-10-06 17:23:02 +00:00
|
|
|
|
|
|
|
|