Delete comments

This commit is contained in:
TimGeyssens
2015-02-04 22:53:12 +01:00
parent b93c45194d
commit 7b74ccba67
4 changed files with 37 additions and 6 deletions
+23 -1
View File
@@ -7,6 +7,18 @@
highFiveComment: function (id) {
$.get("/umbraco/api/Powers/Action/?alias=LikeComment&pageId=" + id);
},
deleteComment: function (id) {
$.ajax({
url: "/umbraco/api/Forum/Comment/" + id,
type: 'DELETE',
success: function (result) {
// Do something with the result
}
});
}
};
}();
@@ -17,7 +29,7 @@ $(function () {
/*FORUM*/
//Mark as solution
$(".comment").on("click","a.solved",function (e) {
$(".comments").on("click","a.solved",function (e) {
e.preventDefault();
var data = $(this).data();
var id = parseInt(data.id);
@@ -41,4 +53,14 @@ $(function () {
$(".highfive-count", cont).html(count);
});
//Delete comment
$(".comments").on("click", "a.delete-reply", function (e) {
e.preventDefault();
var data = $(this).data();
var id = parseInt(data.id);
community.deleteComment(id);
$(this).closest(".comment").slideUp( function () { $(this).closest(".comment").remove(); });
});
});
@@ -94,6 +94,11 @@
<i class="icon-Out"></i><span>Copy Link</span>
</a>
<a href="#" class="delete-reply" data-id="{{id}}">
<i class=" icon-delete-key">
</i><span>Delete post</span>
</a>
<a href="#" data-topic="{{topicId}}" data-parent="{{id}}" data-controller="comment" class="forum-reply reply">
<i class="icon-Reply-arrow"></i><span>Reply</span>
</a>
@@ -86,7 +86,7 @@
</a>
}
<a href="#" class="delete-reply">
<a href="#" class="delete-reply" data-id="@Model.Id">
<i class="icon-Delete-key"></i><span>Delete post</span>
</a>
@@ -100,4 +100,12 @@
</div>
}
else
{
<div class="actions">
<a href="#" id="copy-link" class="copy-link" data-id="@Model.Id">
<i class="icon-Link"></i><span>Copy Link</span>
</a>
</div>
}
</li>
@@ -54,10 +54,6 @@
<i class="icon-Reply-arrow"></i><span>Reply</span>
</a>
<a href="#" class="delete-reply">
<i class="icon-Delete-key"></i><span>Delete post</span>
</a>
<a href="#" class="mark-as-spam">
<i class="icon-Alert-alt"></i><span>Mark as spam</span>
</a>