From ce8a9c33b67c48d6238a89c7fa041504f3d6019c Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Thu, 30 May 2024 18:34:54 +0300 Subject: [PATCH] add visible function to comment datatable actions --- .../Pages/CmsKit/Comments/index.js | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.js index bb7f8039f5..008b10ca00 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.js @@ -5,6 +5,19 @@ $(function () { moment()._locale.preparse = (string) => string; moment()._locale.postformat = (string) => string; + + var commentRequireApprovement = false; + + commentsService.getSettings().then(function (data) { + commentRequireApprovement = data.commentRequireApprovement; + if (data.commentRequireApprovement) { + $('#CommentsTable').DataTable().column(6).visible(true); + } else { + $('#CommentsWaitingAlert').hide() + $('#CommentsTable').DataTable().column(6).visible(false); + $('#IsApprovedSelectInput').hide(); + } + }) var getFormattedDate = function ($datePicker) { if (!$datePicker.val()) { @@ -95,7 +108,9 @@ $(function () { abp.notify.success(message); }) }, - visible: abp.setting.getBoolean("CmsKit.Comments.RequireApprovement") + visible: function (data) { + return commentRequireApprovement; + } }, { text: function (data) { @@ -115,7 +130,9 @@ $(function () { abp.notify.success(message); }) }, - visible: abp.setting.getBoolean("CmsKit.Comments.RequireApprovement") + visible: function (data) { + return commentRequireApprovement; + } } ] } @@ -231,7 +248,7 @@ $(function () { commentsService.getWaitingCount().then(function (count) { if (count > 0) { var alertMessage = l("CommentAlertMessage", count); - var alertElement = '' + alertMessage + ''; + var alertElement = '' + alertMessage + ' ' + ' '; $('#CommentsWaitingAlert').html(alertElement); $('#CommentsWaitingAlert').click(function () { window.location.href = '/Cms/Comments/Approve' @@ -243,14 +260,4 @@ $(function () { } CheckWaitingComments() - - commentsService.getSettings().then(function (data) { - if (data.commentRequireApprovement) { - $('#CommentsTable').DataTable().column(6).visible(true); - } else { - $('#CommentsWaitingAlert').hide() - $('#CommentsTable').DataTable().column(6).visible(false); - $('#IsApprovedSelectInput').hide(); - } - }) }); \ No newline at end of file