mirror of https://github.com/abpframework/abp.git
40 changed files with 4765 additions and 4754 deletions
File diff suppressed because it is too large
@ -1,11 +1,9 @@ |
|||||
using System; |
using System; |
||||
using System.Collections.Generic; |
|
||||
using System.Text; |
|
||||
|
|
||||
namespace Volo.CmsKit.Admin.Comments; |
namespace Volo.CmsKit.Admin.Comments; |
||||
|
|
||||
[Serializable] |
[Serializable] |
||||
public class SettingsDto |
public class SettingsDto |
||||
{ |
{ |
||||
public bool RequireApprovement { get; set; } |
public bool CommentRequireApprovement { get; set; } |
||||
} |
} |
||||
|
|||||
@ -1,17 +0,0 @@ |
|||||
using System.Collections.Generic; |
|
||||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|
||||
|
|
||||
namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Comments.Approve; |
|
||||
|
|
||||
public class PrismjsScriptBundleContributorDocsExtension : BundleContributor |
|
||||
{ |
|
||||
public override void ConfigureBundle(BundleConfigurationContext context) |
|
||||
{ |
|
||||
//AddPlugins(context);
|
|
||||
context.Files.Add("~/libs/markdown-it/markdown-it.min.js"); |
|
||||
} |
|
||||
//private static void AddPlugins(IBundleConfigurationContext context)
|
|
||||
//{
|
|
||||
// context.Files.AddIfNotContains("/libs/markdown-it/markdown-it.min.js");
|
|
||||
//}
|
|
||||
} |
|
||||
@ -1,177 +1,173 @@ |
|||||
|
$(function () { |
||||
|
|
||||
|
var l = abp.localization.getResource("CmsKit"); |
||||
|
|
||||
$(function () { |
var commentsService = volo.cmsKit.admin.comments.commentAdmin; |
||||
|
|
||||
var l = abp.localization.getResource("CmsKit"); |
var detailsModal = new abp.ModalManager(abp.appPath + "CmsKit/Comments/DetailsModal"); |
||||
|
|
||||
var commentsService = volo.cmsKit.admin.comments.commentAdmin; |
moment()._locale.preparse = (string) => string; |
||||
|
moment()._locale.postformat = (string) => string; |
||||
|
|
||||
var detailsModal = new abp.ModalManager(abp.appPath + "CmsKit/Comments/DetailsModal"); |
var getFormattedDate = function ($datePicker) { |
||||
|
if (!$datePicker.val()) { |
||||
|
return null; |
||||
|
} |
||||
|
var momentDate = moment($datePicker.val(), $datePicker.data('daterangepicker').locale.format); |
||||
|
return momentDate.isValid() ? momentDate.toISOString() : null; |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
$('.singledatepicker').daterangepicker({ |
||||
|
"singleDatePicker": true, |
||||
|
"showDropdowns": true, |
||||
|
"autoUpdateInput": false, |
||||
|
"autoApply": true, |
||||
|
"opens": "center", |
||||
|
"drops": "auto" |
||||
|
}); |
||||
|
|
||||
moment()._locale.preparse = (string) => string; |
|
||||
moment()._locale.postformat = (string) => string; |
|
||||
|
|
||||
var getFormattedDate = function ($datePicker) { |
$('.singledatepicker').attr('autocomplete', 'off'); |
||||
if (!$datePicker.val()) { |
|
||||
return null; |
$('.singledatepicker').on('apply.daterangepicker', function (ev, picker) { |
||||
} |
$(this).val(picker.startDate.format('l')); |
||||
var momentDate = moment($datePicker.val(), $datePicker.data('daterangepicker').locale.format); |
}); |
||||
return momentDate.isValid() ? momentDate.toISOString() : null; |
|
||||
}; |
|
||||
|
var filterForm = $('#CmsKitCommentsFilterForm'); |
||||
|
|
||||
$('.singledatepicker').daterangepicker({ |
var getFilter = function () { |
||||
"singleDatePicker": true, |
var filterObj = filterForm.serializeFormToObject(); |
||||
"showDropdowns": true, |
|
||||
"autoUpdateInput": false, |
filterObj.creationStartDate = getFormattedDate($('#CreationStartDate')); |
||||
"autoApply": true, |
filterObj.creationEndDate = getFormattedDate($('#CreationEndDate')); |
||||
"opens": "center", |
|
||||
"drops": "auto" |
return filterObj; |
||||
}); |
}; |
||||
|
|
||||
|
|
||||
|
var _dataTable = $('#CommentsTable').DataTable(abp.libs.datatables.normalizeConfiguration({ |
||||
$('.singledatepicker').attr('autocomplete', 'off'); |
processing: true, |
||||
|
serverSide: true, |
||||
$('.singledatepicker').on('apply.daterangepicker', function (ev, picker) { |
paging: true, |
||||
$(this).val(picker.startDate.format('l')); |
scrollX: true, |
||||
}); |
searching: false, |
||||
|
scrollCollapse: true, |
||||
|
ajax: abp.libs.datatables.createAjax(commentsService.getWaitingCommentsWithReplies, getFilter), |
||||
var filterForm = $('#CmsKitCommentsFilterForm'); |
columnDefs: [ |
||||
|
{ |
||||
var getFilter = function () { |
width: "10%", |
||||
var filterObj = filterForm.serializeFormToObject(); |
title: l("Actions"), |
||||
|
targets: 0, |
||||
filterObj.creationStartDate = getFormattedDate($('#CreationStartDate')); |
orderable: false, |
||||
filterObj.creationEndDate = getFormattedDate($('#CreationEndDate')); |
rowAction: { |
||||
|
items: [ |
||||
return filterObj; |
{ |
||||
}; |
text: function (data) { |
||||
|
return l('Approve'); |
||||
|
|
||||
var _dataTable = $('#CommentsTable').DataTable(abp.libs.datatables.normalizeConfiguration({ |
|
||||
processing: true, |
|
||||
serverSide: true, |
|
||||
paging: true, |
|
||||
scrollX: true, |
|
||||
searching: false, |
|
||||
scrollCollapse: true, |
|
||||
ajax: abp.libs.datatables.createAjax(commentsService.getWaitingCommentsWithReplies, getFilter), |
|
||||
columnDefs: [ |
|
||||
{ |
|
||||
width: "10%", |
|
||||
title: l("Actions"), |
|
||||
targets: 0, |
|
||||
orderable: false, |
|
||||
rowAction: { |
|
||||
items: [ |
|
||||
{ |
|
||||
text: function (data) { |
|
||||
return l('Approve'); |
|
||||
}, |
|
||||
action: function (data) { |
|
||||
var newApprovalStatus = true; |
|
||||
|
|
||||
commentsService |
|
||||
.updateApprovalStatus(data.record.id, { IsApproved: newApprovalStatus }) |
|
||||
.then(function () { |
|
||||
_dataTable.ajax.reloadEx(); |
|
||||
var message = newApprovalStatus ? l('ApprovedSuccessfully') : l('ApprovalRevokedSuccessfully'); |
|
||||
abp.notify.success(message); |
|
||||
}) |
|
||||
.catch(function (error) { |
|
||||
abp.notify.error(error.message); |
|
||||
}); |
|
||||
} |
|
||||
}, |
}, |
||||
{ |
action: function (data) { |
||||
text: function (data) { |
var newApprovalStatus = true; |
||||
return l('Disapproved'); |
|
||||
}, |
commentsService |
||||
action: function (data) { |
.updateApprovalStatus(data.record.id, {IsApproved: newApprovalStatus}) |
||||
var newApprovalStatus = false; |
.then(function () { |
||||
|
_dataTable.ajax.reloadEx(); |
||||
commentsService |
var message = newApprovalStatus ? l('ApprovedSuccessfully') : l('ApprovalRevokedSuccessfully'); |
||||
.updateApprovalStatus(data.record.id, { IsApproved: newApprovalStatus }) |
abp.notify.success(message); |
||||
.then(function () { |
}) |
||||
_dataTable.ajax.reloadEx(); |
.catch(function (error) { |
||||
var message = newApprovalStatus ? l('ApprovedSuccessfully') : l('ApprovalRevokedSuccessfully'); |
abp.notify.error(error.message); |
||||
abp.notify.success(message); |
}); |
||||
}) |
} |
||||
.catch(function (error) { |
}, |
||||
abp.notify.error(error.message); |
{ |
||||
}); |
text: function (data) { |
||||
} |
return l('Disapproved'); |
||||
|
}, |
||||
|
action: function (data) { |
||||
|
var newApprovalStatus = false; |
||||
|
|
||||
|
commentsService |
||||
|
.updateApprovalStatus(data.record.id, {IsApproved: newApprovalStatus}) |
||||
|
.then(function () { |
||||
|
_dataTable.ajax.reloadEx(); |
||||
|
var message = newApprovalStatus ? l('ApprovedSuccessfully') : l('ApprovalRevokedSuccessfully'); |
||||
|
abp.notify.success(message); |
||||
|
}) |
||||
|
.catch(function (error) { |
||||
|
abp.notify.error(error.message); |
||||
|
}); |
||||
} |
} |
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
width: "10%", |
|
||||
title: l("Username"), |
|
||||
orderable: false, |
|
||||
data: "author.userName", |
|
||||
render: function (data) { |
|
||||
if (data !== null) { |
|
||||
return GetFilterableDatatableContent('#Author', $.fn.dataTable.render.text().display(data)); //prevent against possible XSS
|
|
||||
} |
} |
||||
return ""; |
] |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
width: "10%", |
||||
|
title: l("Username"), |
||||
|
orderable: false, |
||||
|
data: "author.userName", |
||||
|
render: function (data) { |
||||
|
if (data !== null) { |
||||
|
return GetFilterableDatatableContent('#Author', $.fn.dataTable.render.text().display(data)); //prevent against possible XSS
|
||||
} |
} |
||||
}, |
return ""; |
||||
{ |
} |
||||
width: "15%", |
}, |
||||
title: l("EntityType"), |
{ |
||||
orderable: false, |
width: "15%", |
||||
data: "entityType", |
title: l("EntityType"), |
||||
render: function (data) { |
orderable: false, |
||||
if (data !== null) { |
data: "entityType", |
||||
return GetFilterableDatatableContent('#EntityType', $.fn.dataTable.render.text().display(data)); |
render: function (data) { |
||||
} |
if (data !== null) { |
||||
return ""; |
return GetFilterableDatatableContent('#EntityType', $.fn.dataTable.render.text().display(data)); |
||||
} |
} |
||||
}, |
return ""; |
||||
{ |
} |
||||
title: l("Text"), |
}, |
||||
data: "text", |
{ |
||||
orderable: false, |
title: l("Text"), |
||||
|
data: "text", |
||||
|
orderable: false, |
||||
|
|
||||
|
|
||||
render: function (data) { |
render: function (data) { |
||||
|
|
||||
//var converter = new showdown.Converter();
|
//var converter = new showdown.Converter();
|
||||
//var htmlContent = converter.makeHtml(data);
|
//var htmlContent = converter.makeHtml(data);
|
||||
var md = window.markdownit(); |
var md = window.markdownit(); |
||||
var htmlContent = md.render(data); |
var htmlContent = md.render(data); |
||||
return (htmlContent); |
return (htmlContent); |
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
width: "15%", |
|
||||
title: l("CreationTime"), |
|
||||
data: "creationTime", |
|
||||
orderable: true, |
|
||||
dataFormat: "datetime" |
|
||||
} |
} |
||||
] |
}, |
||||
})); |
{ |
||||
|
width: "15%", |
||||
|
title: l("CreationTime"), |
||||
|
data: "creationTime", |
||||
|
orderable: true, |
||||
|
dataFormat: "datetime" |
||||
|
} |
||||
|
] |
||||
|
})); |
||||
|
|
||||
function GetFilterableDatatableContent(filterSelector, data) { |
function GetFilterableDatatableContent(filterSelector, data) { |
||||
return '<span class="datatableCell" data-field="' + filterSelector + '" data-val="' + data + '">' + data + '</span>'; |
return '<span class="datatableCell" data-field="' + filterSelector + '" data-val="' + data + '">' + data + '</span>'; |
||||
} |
} |
||||
|
|
||||
$(document).on('click', '.datatableCell', function () { |
$(document).on('click', '.datatableCell', function () { |
||||
var inputSelector = $(this).attr('data-field'); |
var inputSelector = $(this).attr('data-field'); |
||||
var value = $(this).attr('data-val'); |
var value = $(this).attr('data-val'); |
||||
|
|
||||
$(inputSelector).val(value); |
$(inputSelector).val(value); |
||||
|
|
||||
_dataTable.ajax.reloadEx(); |
_dataTable.ajax.reloadEx(); |
||||
}); |
}); |
||||
|
|
||||
filterForm.submit(function (e) { |
filterForm.submit(function (e) { |
||||
e.preventDefault(); |
e.preventDefault(); |
||||
_dataTable.ajax.reloadEx(); |
_dataTable.ajax.reloadEx(); |
||||
}); |
|
||||
}); |
}); |
||||
|
}); |
||||
|
|||||
@ -0,0 +1,12 @@ |
|||||
|
using System; |
||||
|
|
||||
|
namespace Volo.CmsKit.Comments; |
||||
|
|
||||
|
[Flags] |
||||
|
public enum CommentApproveState |
||||
|
{ |
||||
|
All = 0, |
||||
|
Approved = 1, |
||||
|
Disapproved = 2, |
||||
|
Waiting = 4 |
||||
|
} |
||||
@ -1,12 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Text; |
|
||||
|
|
||||
namespace Volo.CmsKit.Comments; |
|
||||
public enum CommentApproveStateType |
|
||||
{ |
|
||||
All, |
|
||||
Approved, |
|
||||
Disapproved, |
|
||||
Waiting |
|
||||
} |
|
||||
@ -1,9 +1,6 @@ |
|||||
using System; |
namespace Volo.CmsKit.Settings; |
||||
using System.Collections.Generic; |
|
||||
using System.Text; |
|
||||
|
|
||||
namespace Volo.CmsKit.Settings; |
|
||||
public static class AppSettings |
public static class AppSettings |
||||
{ |
{ |
||||
public const string RequireApprovement = "Comments.RequireApprovement"; |
public const string CommentRequireApprovement = "Comments.RequireApprovement"; |
||||
} |
} |
||||
|
|||||
Loading…
Reference in new issue