Browse Source

Show a warning when enabling Require Approval Comment settings

pull/19919/head
Berkan Sasmaz 2 years ago
parent
commit
f6a350799f
  1. 27
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Shared/Components/Comments/default.js
  2. 4
      modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json

27
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Shared/Components/Comments/default.js

@ -13,11 +13,30 @@
};
var _bindEvents = function () {
var $requireApprovalCheckbox = $('#RequireApprovementCheckbox');
var previousValue = $requireApprovalCheckbox.prop('checked');
$wrapper.find('#Save').click(function () {
var isChecked = $('#RequireApprovementCheckbox').prop('checked');
_service.updateSettings({ commentRequireApprovement: isChecked }).then(function (response) {
abp.notify.success(l("SavedSuccessfully"));
})
var isRequireApproved = $requireApprovalCheckbox.prop('checked');
function UpdateSettings(commentRequireApprovement) {
_service.updateSettings({commentRequireApprovement: commentRequireApprovement}).then(function (response) {
abp.notify.success(l("SavedSuccessfully"));
previousValue = commentRequireApprovement;
})
}
if (isRequireApproved && !previousValue) {
abp.message.confirm(l("CommentRequireApprovementWarning"), function (ok) {
if (ok) {
UpdateSettings(isRequireApproved);
} else {
$('#RequireApprovementCheckbox').prop('checked', false);
}
});
} else {
UpdateSettings(isRequireApproved);
}
});
};

4
modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json

@ -244,6 +244,8 @@
"CommentAlertMessage":"There are {0} comments waiting for approval",
"Settings:Menu:CmsKit":"CMS",
"CommentsAwaitingApproval":"Comments Awaiting Approval",
"CommentSubmittedForApproval": "Your comment has been submitted for approval."
"CommentSubmittedForApproval": "Your comment has been submitted for approval.",
"CommentUpdatedForApproval": "Your comment has been updated and submitted for approval.",
"CommentRequireApprovementWarning": "Once this setting is enabled, your existing comments will not appear in the UI if they are not approved. Do you want to continue the process?"
}
}
Loading…
Cancel
Save