Delete comment/thread
This commit is contained in:
@@ -49,3 +49,4 @@ OurUmbraco.Site_419
|
||||
OurUmbraco.Site/App_Data/cache/
|
||||
*.sln.ide/
|
||||
NuGetBackup
|
||||
OurUmbraco.Site/web.config
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -9,11 +9,14 @@
|
||||
$.get("/umbraco/api/Powers/Action/?alias=LikeComment&pageId=" + id);
|
||||
},
|
||||
|
||||
deleteComment: function (id) {
|
||||
deleteComment: function (id, thisComment) {
|
||||
|
||||
$.ajax({
|
||||
url: "/umbraco/api/Forum/Comment/" + id,
|
||||
type: 'DELETE'
|
||||
})
|
||||
.done(function () {
|
||||
thisComment
|
||||
});
|
||||
|
||||
},
|
||||
@@ -21,7 +24,10 @@
|
||||
deleteThread: function (id) {
|
||||
$.ajax({
|
||||
url: "/umbraco/api/Topic/Delete/" + id,
|
||||
type: 'DELETE'
|
||||
type: 'DELETE',
|
||||
})
|
||||
.done(function () {
|
||||
window.location = "/forum";
|
||||
});
|
||||
},
|
||||
|
||||
@@ -60,19 +66,19 @@ $(function () {
|
||||
e.preventDefault
|
||||
|
||||
if (deepLinking === false) {
|
||||
body.addClass("active");
|
||||
body.addClass("active copy-prompt");
|
||||
getLink.val(window.location.hostname + window.location.pathname + $(this).attr("data-id"));
|
||||
getLink.focus().select();
|
||||
deepLinking = true;
|
||||
} else {
|
||||
body.removeClass("active");
|
||||
body.removeClass("active copy-prompt");
|
||||
deepLinking = false;
|
||||
}
|
||||
});
|
||||
|
||||
getLink.keydown(function (e) {
|
||||
if ((e.metaKey || e.ctrlKey) && e.keyCode === 67) {
|
||||
body.removeClass("active");
|
||||
body.removeClass("active copy-prompt");
|
||||
|
||||
thankyou.style.opacity = 1;
|
||||
thankyou.style.top = "10%";
|
||||
@@ -87,7 +93,7 @@ $(function () {
|
||||
});
|
||||
|
||||
$('.overlay').on('click', function () {
|
||||
body.removeClass('active');
|
||||
body.removeClass('active copy-prompt');
|
||||
deepLinking = false;
|
||||
});
|
||||
|
||||
@@ -111,11 +117,13 @@ $(function () {
|
||||
//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").fadeOut( function () { $(this).closest(".comment").remove(); });
|
||||
|
||||
var $thisComment = $(this).closest(".comment");
|
||||
// $(this).closest(".comment").fadeOut(function () { $(this).closest(".comment").remove(); });
|
||||
|
||||
terminateConfirm("comment", id, $thisComment);
|
||||
});
|
||||
|
||||
//Delete thread
|
||||
@@ -123,6 +131,44 @@ $(function () {
|
||||
e.preventDefault();
|
||||
var data = $(this).data();
|
||||
var id = parseInt(data.id);
|
||||
community.deleteThread(id);
|
||||
|
||||
terminateConfirm("thread", id);
|
||||
});
|
||||
|
||||
function terminateConfirm(typeOfPost, id, thisComment) {
|
||||
var $confirm = $('#confirm-wrapper');
|
||||
var $confirmType = $('#confirm-wrapper .type-of')
|
||||
var $body = $('body');
|
||||
|
||||
$body.addClass('active confirm-prompt');
|
||||
|
||||
$confirmType.html(typeOfPost);
|
||||
|
||||
$('#confirm-wrapper .green').on('click', function (e) {
|
||||
e.preventDefault;
|
||||
|
||||
terminatePost(typeOfPost, id, thisComment);
|
||||
$body.removeClass('active confirm-prompt');
|
||||
});
|
||||
|
||||
$('#confirm-wrapper .red').on('click', function (e) {
|
||||
e.preventDefault;
|
||||
|
||||
$body.removeClass('active confirm-prompt');
|
||||
});
|
||||
}
|
||||
|
||||
function terminatePost(typeOfPost, id, thisComment) {
|
||||
switch (typeOfPost) {
|
||||
case "comment":
|
||||
community.deleteComment(id);
|
||||
thisComment.closest(".comment").fadeOut(function () { thisComment.closest(".comment").remove(); });
|
||||
break;
|
||||
case "thread":
|
||||
community.deleteThread(id);
|
||||
break;
|
||||
default:
|
||||
alert('Something went wrong')
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+12
-12
@@ -21,7 +21,7 @@
|
||||
|
||||
editor.hooks.set('insertImageDialog', function (callback) {
|
||||
|
||||
$dialog.show();
|
||||
$dialog.show().addClass('show');
|
||||
|
||||
var uploadStart = function () {
|
||||
$loader.show();
|
||||
@@ -52,8 +52,6 @@
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(thisEditorInput).change(function () {
|
||||
thisEditorDraft.removeClass('show');
|
||||
if (typeof (Storage) !== 'undefined') {
|
||||
@@ -61,8 +59,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
editor.run();
|
||||
|
||||
|
||||
@@ -74,17 +70,20 @@
|
||||
|
||||
showEditor();
|
||||
|
||||
// draft
|
||||
});
|
||||
|
||||
// draft
|
||||
function showDraft () {
|
||||
if (typeof (Storage) !== 'undefined' && localStorage.getItem('ufdraft') != null) {
|
||||
thisEditorDraft.addClass('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
showDraft();
|
||||
|
||||
$('.markdown-close').on('click', function () {
|
||||
hideEditor();
|
||||
if ($.trim(thisEditorPreview.text()) != "") {
|
||||
if ($.trim(thisEditorPreview.text()) == "") {
|
||||
thisEditorDraft.addClass('show');
|
||||
|
||||
if (typeof (Storage) !== 'undefined') {
|
||||
@@ -92,6 +91,8 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
showDraft();
|
||||
});
|
||||
|
||||
$("#topic-submit").on("click", function (event) {
|
||||
@@ -154,8 +155,6 @@
|
||||
|
||||
function submit() {
|
||||
|
||||
|
||||
|
||||
var type = "Post";
|
||||
if (state.id) {
|
||||
type = "Put";
|
||||
@@ -229,7 +228,8 @@
|
||||
thisEditor.removeClass('write');
|
||||
thisEditorSpacer.removeClass('write')
|
||||
}
|
||||
thisEditorMobilePreview.on('click', function () {
|
||||
thisEditorMobilePreview.on('click', function (e) {
|
||||
e.preventDefault();
|
||||
thisEditor.toggleClass('mobile-preview');
|
||||
switch ($(this).attr('value')) {
|
||||
case 'Preview':
|
||||
|
||||
@@ -25,6 +25,19 @@
|
||||
|
||||
<!-- COPY LINK END -->
|
||||
|
||||
<!-- DELETE THREAD/COMMENT START -->
|
||||
@if (Members.IsLoggedIn())
|
||||
{
|
||||
<div id="confirm-wrapper" class="confirm-wrapper">
|
||||
<h4>Are you sure?</h4>
|
||||
<p>This <span class="type-of"></span> will be gone forever and ever</p>
|
||||
<br />
|
||||
<button class="button green tiny" href="#">Yes</button>
|
||||
<button class="button red tiny" href="#">No</button>
|
||||
</div>
|
||||
}
|
||||
<!-- DELETE THREAD END -->
|
||||
|
||||
<ul class="comments">
|
||||
@Html.Partial("forum/question", topic)
|
||||
|
||||
|
||||
@@ -35,11 +35,11 @@
|
||||
<span class="markdown-close icon-Page-down"></span>
|
||||
<div class="draft">Draft</div>
|
||||
</div>
|
||||
<div id="insert-image-dialog" class="wmd-prompt-dialog" style="position: fixed; width: 400px; z-index: 1001; top: 50%; left: 50%; display: none; margin-top: -86px; margin-left: -200px;">
|
||||
|
||||
<div id="insert-image-dialog" class="wmd-prompt-dialog" style="display: none;">
|
||||
<div style="padding: 5px;">
|
||||
<h4>
|
||||
Upload an image
|
||||
</h4>
|
||||
<p><b>Upload image</b></p>
|
||||
<p>Image will be uploaded when post is submitted</p>
|
||||
<div class="span" style="display:none;"><div class=" loader"></div></div>
|
||||
<input type="file" name="file" id="file" data-action="/umbraco/api/forum/editorupload" />
|
||||
<div style="text-align:center;">
|
||||
@@ -90,7 +90,6 @@
|
||||
|
||||
<div class="actions">
|
||||
|
||||
|
||||
<a href="#" class="copy-link" data-id="{{id}}">
|
||||
<i class="icon-Out"></i><span>Copy Link</span>
|
||||
</a>
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
@inherits Umbraco.Web.Mvc.UmbracoViewPage<uForum.Models.Comment>
|
||||
@using uForum;
|
||||
|
||||
var answer = (int)ViewData["answer"];
|
||||
var mem = Members.GetCurrentMember();
|
||||
|
||||
if (Members.IsLoggedIn())
|
||||
{
|
||||
|
||||
<div class="actions">
|
||||
|
||||
<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>
|
||||
|
||||
@if (answer == 0 && (Members.IsAdmin() || mem.Id == Model.MemberId))
|
||||
{
|
||||
<a href="#" class="solved" data-id="@Model.Id">
|
||||
<i class="icon-Check"></i><span>Mark as solution</span>
|
||||
</a>
|
||||
}
|
||||
|
||||
<a href="#" id="copy-link" class="copy-link" data-id="@Model.Id">
|
||||
<i class="icon-Link"></i><span>Copy Link</span>
|
||||
</a>
|
||||
|
||||
@if (Model.ParentCommentId <= 0)
|
||||
{
|
||||
<a href="#" data-topic="@Model.TopicId" data-parent="@Model.Id" data-controller="comment" class="forum-reply reply">
|
||||
<i class="icon-Reply-arrow"></i><span>Reply</span>
|
||||
</a>
|
||||
}
|
||||
|
||||
<a href="#" class="edit-post">
|
||||
<i class="icon-Edit"></i><span>Edit post</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
}
|
||||
Reference in New Issue
Block a user