add remove feature comments
This commit is contained in:
parent
d1f9c12c2d
commit
c3d6b8ea41
5 changed files with 31 additions and 11 deletions
|
@ -1,3 +1,5 @@
|
|||
{% set logged_in = request.user.is_authenticated %}
|
||||
{% set profile = request.profile if logged_in else None %}
|
||||
{% for node in mptt_tree(comment_list) recursive %}
|
||||
<li id="comment-{{ node.id }}" data-revision="{{ node.revisions - 1 }}" data-max-revision="{{ node.revisions - 1 }}"
|
||||
data-revision-ajax="{{ url('comment_revision_ajax', node.id) }}" class="comment">
|
||||
|
@ -120,14 +122,14 @@
|
|||
|
||||
{% set comment_more = comment_count - offset %}
|
||||
{% if comment_more == 1 %}
|
||||
<a href="javascript:comment_show_more({{ comment_root_id }}, {{ comment_parrent_none }}, {{ offset }} )" class="show_more_comment">
|
||||
<a href="javascript:comment_show_more({{ comment_root_id }}, {{ comment_parrent_none }}, {{ offset }}, {{ comment_remove }})" class="show_more_comment">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-down" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M6 9l6 6l6 -6"></path>
|
||||
</svg>
|
||||
{{ comment_count - offset }} comment more</a>
|
||||
{% elif comment_more > 1 %}
|
||||
<a href="javascript:comment_show_more({{ comment_root_id }}, {{ comment_parrent_none }}, {{ offset }} )" class="show_more_comment">
|
||||
<a href="javascript:comment_show_more({{ comment_root_id }}, {{ comment_parrent_none }}, {{ offset }}, {{ comment_remove }})" class="show_more_comment">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-down" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M6 9l6 6l6 -6"></path>
|
||||
|
|
|
@ -152,7 +152,7 @@
|
|||
{% endfor %}
|
||||
{% set comment_more = comment_count - offset %}
|
||||
{% if comment_more == 1 %}
|
||||
<a href="javascript:comment_show_more({{ comment_root_id }}, {{ comment_parrent_none }}, {{ offset }} )" class="show_more_comment">
|
||||
<a href="javascript:comment_show_more({{ comment_root_id }}, {{ comment_parrent_none }}, {{ offset }}, {{ comment_remove }})" class="show_more_comment">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-down" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M6 9l6 6l6 -6"></path>
|
||||
|
@ -160,7 +160,7 @@
|
|||
{{ comment_count - offset }} comment more
|
||||
</a>
|
||||
{% elif comment_more > 1 %}
|
||||
<a href="javascript:comment_show_more({{ comment_root_id }}, {{ comment_parrent_none }}, {{ offset }} )" class="show_more_comment">
|
||||
<a href="javascript:comment_show_more({{ comment_root_id }}, {{ comment_parrent_none }}, {{ offset }}, {{ comment_remove }})" class="show_more_comment">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-down" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M6 9l6 6l6 -6"></path>
|
||||
|
@ -171,7 +171,7 @@
|
|||
{% else %}
|
||||
{% include "comments/content-list.html" %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
</ul>
|
||||
{% elif not comment_lock %}
|
||||
<p class="no-comments-message">{{ _('There are no comments at the moment.') }}</p>
|
||||
|
|
|
@ -119,6 +119,10 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
const queryString = window.location.search;
|
||||
const urlParams = new URLSearchParams(queryString);
|
||||
const comment_remove = urlParams.get('comment-id');
|
||||
console.log(comment_remove);
|
||||
|
||||
window.comment_get_replies = function (id, parrent_none) {
|
||||
var $comment_show_btn = $("#comment-" + id + " .show_more_reply");
|
||||
|
@ -145,7 +149,7 @@
|
|||
})
|
||||
}
|
||||
|
||||
window.comment_show_more = function (id, parrent_none, offset) {
|
||||
window.comment_show_more = function (id, parrent_none, offset, comment_remove) {
|
||||
console.log(parrent_none)
|
||||
if (parrent_none == 1) {
|
||||
var $comment_show_btn = $("#comment-0" + " .show_more_comment");
|
||||
|
@ -158,10 +162,10 @@
|
|||
var $comment = $("#comment-" + id + "-children");
|
||||
$comment.append("<p class='loading'> Loading... </p>");
|
||||
}
|
||||
ajax_comment_show_more('{{ url('comment_show_more') }}', id, parrent_none, offset);
|
||||
ajax_comment_show_more('{{ url('comment_show_more') }}', id, parrent_none, offset, comment_remove);
|
||||
}
|
||||
|
||||
function ajax_comment_show_more(url, id, parrent_none, offset) {
|
||||
function ajax_comment_show_more(url, id, parrent_none, offset, comment_remove) {
|
||||
return $.ajax({
|
||||
url: url,
|
||||
type: 'GET',
|
||||
|
@ -169,6 +173,7 @@
|
|||
id: id,
|
||||
parrent_none: parrent_none,
|
||||
offset: offset,
|
||||
comment_remove: comment_remove,
|
||||
},
|
||||
success: function(data) {
|
||||
if (parrent_none == 1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue