|
|
|
@ -1,10 +1,10 @@ |
|
|
|
(function ($) { |
|
|
|
|
|
|
|
var l = abp.localization.getResource('CmsKit'); |
|
|
|
let l = abp.localization.getResource('CmsKit'); |
|
|
|
|
|
|
|
abp.widgets.CmsCommenting = function ($widget) { |
|
|
|
var widgetManager = $widget.data('abp-widget-manager'); |
|
|
|
var $commentArea = $widget.find('.cms-comment-area'); |
|
|
|
let widgetManager = $widget.data('abp-widget-manager'); |
|
|
|
let $commentArea = $widget.find('.cms-comment-area'); |
|
|
|
|
|
|
|
function getFilters() { |
|
|
|
return { |
|
|
|
@ -15,14 +15,14 @@ |
|
|
|
|
|
|
|
function registerEditLinks($container) { |
|
|
|
$container.find('.comment-edit-link').each(function () { |
|
|
|
var $link = $(this); |
|
|
|
let $link = $(this); |
|
|
|
$link.on('click', function (e) { |
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
var commentId = $link.data('id'); |
|
|
|
let commentId = $link.data('id'); |
|
|
|
|
|
|
|
var $relatedCommentContentArea = $container.find('.cms-comment-content-area[data-id=' + commentId + ']'); |
|
|
|
var $relatedCommentEditFormArea = $container.find('.cms-comment-edit-area[data-id=' + commentId + ']'); |
|
|
|
let $relatedCommentContentArea = $container.find('.cms-comment-content-area[data-id=' + commentId + ']'); |
|
|
|
let $relatedCommentEditFormArea = $container.find('.cms-comment-edit-area[data-id=' + commentId + ']'); |
|
|
|
|
|
|
|
$relatedCommentContentArea.hide(); |
|
|
|
$relatedCommentEditFormArea.show(); |
|
|
|
@ -30,15 +30,15 @@ |
|
|
|
}); |
|
|
|
}); |
|
|
|
$container.find('.comment-edit-cancel-button').each(function () { |
|
|
|
var $button = $(this); |
|
|
|
let $button = $(this); |
|
|
|
$button.on('click', function (e) { |
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
var commentId = $button.data('id'); |
|
|
|
let commentId = $button.data('id'); |
|
|
|
|
|
|
|
var $relatedCommentContentArea = $container.find('.cms-comment-content-area[data-id=' + commentId + ']'); |
|
|
|
var $relatedCommentEditFormArea = $container.find('.cms-comment-edit-area[data-id=' + commentId + ']'); |
|
|
|
var $link = $container.find('.comment-edit-link[data-id=' + commentId + ']'); |
|
|
|
let $relatedCommentContentArea = $container.find('.cms-comment-content-area[data-id=' + commentId + ']'); |
|
|
|
let $relatedCommentEditFormArea = $container.find('.cms-comment-edit-area[data-id=' + commentId + ']'); |
|
|
|
let $link = $container.find('.comment-edit-link[data-id=' + commentId + ']'); |
|
|
|
|
|
|
|
$relatedCommentContentArea.show(); |
|
|
|
$relatedCommentEditFormArea.hide(); |
|
|
|
@ -49,14 +49,14 @@ |
|
|
|
|
|
|
|
function registerReplyLinks($container) { |
|
|
|
$container.find('.comment-reply-link').each(function () { |
|
|
|
var $link = $(this); |
|
|
|
let $link = $(this); |
|
|
|
$link.on('click', function (e) { |
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
var replyCommentId = $link.data('reply-id'); |
|
|
|
let replyCommentId = $link.data('reply-id'); |
|
|
|
|
|
|
|
var $relatedCommentArea = $container.find('.cms-comment-form-area[data-reply-id=' + replyCommentId + ']'); |
|
|
|
var $links = $container.find('.comment-reply-link[data-reply-id=' + replyCommentId + ']'); |
|
|
|
let $relatedCommentArea = $container.find('.cms-comment-form-area[data-reply-id=' + replyCommentId + ']'); |
|
|
|
let $links = $container.find('.comment-reply-link[data-reply-id=' + replyCommentId + ']'); |
|
|
|
|
|
|
|
$relatedCommentArea.show(); |
|
|
|
$relatedCommentArea.find('textarea').focus(); |
|
|
|
@ -64,14 +64,14 @@ |
|
|
|
}); |
|
|
|
}); |
|
|
|
$container.find('.reply-cancel-button').each(function () { |
|
|
|
var $button = $(this); |
|
|
|
let $button = $(this); |
|
|
|
$button.on('click', function (e) { |
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
var replyCommentId = $button.data('reply-id'); |
|
|
|
let replyCommentId = $button.data('reply-id'); |
|
|
|
|
|
|
|
var $relatedCommentArea = $container.find('.cms-comment-form-area[data-reply-id=' + replyCommentId + ']'); |
|
|
|
var $links = $container.find('.comment-reply-link[data-reply-id=' + replyCommentId + ']'); |
|
|
|
let $relatedCommentArea = $container.find('.cms-comment-form-area[data-reply-id=' + replyCommentId + ']'); |
|
|
|
let $links = $container.find('.comment-reply-link[data-reply-id=' + replyCommentId + ']'); |
|
|
|
|
|
|
|
$relatedCommentArea.hide(); |
|
|
|
$links.removeClass('disabled'); |
|
|
|
@ -81,7 +81,7 @@ |
|
|
|
|
|
|
|
function registerDeleteLinks($container) { |
|
|
|
$container.find('.comment-delete-link').each(function () { |
|
|
|
var $link = $(this); |
|
|
|
let $link = $(this); |
|
|
|
$link.on('click', '', function (e) { |
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
@ -99,10 +99,10 @@ |
|
|
|
|
|
|
|
function registerUpdateOfNewComment($container) { |
|
|
|
$container.find('.cms-comment-update-form').each(function () { |
|
|
|
var $form = $(this); |
|
|
|
let $form = $(this); |
|
|
|
$form.submit(function (e) { |
|
|
|
e.preventDefault(); |
|
|
|
var formAsObject = $form.serializeFormToObject(); |
|
|
|
let formAsObject = $form.serializeFormToObject(); |
|
|
|
volo.cmsKit.public.comments.commentPublic.update( |
|
|
|
formAsObject.id, |
|
|
|
{ |
|
|
|
@ -118,21 +118,22 @@ |
|
|
|
|
|
|
|
function registerSubmissionOfNewComment($container) { |
|
|
|
$container.find('.cms-comment-form').each(function () { |
|
|
|
var $form = $(this); |
|
|
|
let $form = $(this); |
|
|
|
$form.submit(function (e) { |
|
|
|
e.preventDefault(); |
|
|
|
var formAsObject = $form.serializeFormToObject(); |
|
|
|
let formAsObject = $form.serializeFormToObject(); |
|
|
|
|
|
|
|
if (formAsObject.repliedCommentId == ''){ |
|
|
|
if (formAsObject.repliedCommentId == '') { |
|
|
|
formAsObject.repliedCommentId = null; |
|
|
|
} |
|
|
|
|
|
|
|
volo.cmsKit.public.comments.commentPublic.create( |
|
|
|
$commentArea.attr('data-entity-type'), |
|
|
|
$commentArea.attr('data-entity-id'), |
|
|
|
{ |
|
|
|
repliedCommentId: formAsObject.repliedCommentId, |
|
|
|
text: formAsObject.commentText |
|
|
|
text: formAsObject.commentText, |
|
|
|
captchaToken: formAsObject.captchaId, |
|
|
|
captchaAnswer: formAsObject.input.captcha |
|
|
|
} |
|
|
|
).then(function () { |
|
|
|
widgetManager.refresh($widget); |
|
|
|
@ -146,7 +147,7 @@ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
var $link = $(location.hash + '_link'); |
|
|
|
let $link = $(location.hash + '_link'); |
|
|
|
|
|
|
|
if ($link.length > 0) { |
|
|
|
$link.click(); |
|
|
|
|