|
|
|
@ -1,17 +1,26 @@ |
|
|
|
|
|
|
|
$(function () { |
|
|
|
var l = abp.localization.getResource("CmsKit"); |
|
|
|
var $statusFilter = $("#StatusSelect"); |
|
|
|
|
|
|
|
var blogPostStatus = { |
|
|
|
Draft: 0, |
|
|
|
Published: 1 |
|
|
|
Published: 1, |
|
|
|
SendToReview: 2 |
|
|
|
}; |
|
|
|
|
|
|
|
var blogsService = volo.cmsKit.admin.blogs.blogPostAdmin; |
|
|
|
|
|
|
|
|
|
|
|
var getFilter = function () { |
|
|
|
return { |
|
|
|
var filter = { |
|
|
|
filter: $('#CmsKitBlogPostsWrapper input.page-search-filter-text').val() |
|
|
|
}; |
|
|
|
|
|
|
|
if ($statusFilter.val()) { |
|
|
|
filter.status = $statusFilter.val(); |
|
|
|
} |
|
|
|
|
|
|
|
return filter; |
|
|
|
}; |
|
|
|
|
|
|
|
var dataTable = $("#BlogPostsTable").DataTable(abp.libs.datatables.normalizeConfiguration({ |
|
|
|
@ -51,6 +60,25 @@ $(function () { |
|
|
|
.then(function () { |
|
|
|
dataTable.ajax.reload(); |
|
|
|
abp.notify.success(l('SuccessfullyPublished')); |
|
|
|
checkHasBlogPostWaitingForReview(); |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
text: l('SendToReview'), |
|
|
|
visible: function(data) { |
|
|
|
return data?.status === blogPostStatus.Draft && |
|
|
|
!abp.auth.isGranted('CmsKit.BlogPosts.Publish'); |
|
|
|
}, |
|
|
|
confirmMessage: function (data) { |
|
|
|
return l("BlogPostPublishConfirmationMessage", data.record.title) |
|
|
|
}, |
|
|
|
action: function (data) { |
|
|
|
blogsService |
|
|
|
.sendToReview(data.record.id) |
|
|
|
.then(function () { |
|
|
|
dataTable.ajax.reload(); |
|
|
|
abp.notify.success(l('BlogPostSendToReviewSuccessMessage', data.record.title)); |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
@ -68,6 +96,7 @@ $(function () { |
|
|
|
.then(function () { |
|
|
|
dataTable.ajax.reload(); |
|
|
|
abp.notify.success(l('SuccessfullySaved')); |
|
|
|
checkHasBlogPostWaitingForReview(); |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
@ -130,4 +159,25 @@ $(function () { |
|
|
|
e.preventDefault(); |
|
|
|
window.location.href = "BlogPosts/Create" |
|
|
|
}); |
|
|
|
|
|
|
|
$('#button-show-waiting-for-review').on('click', function (e) { |
|
|
|
e.preventDefault(); |
|
|
|
$statusFilter.val(blogPostStatus.SendToReview); |
|
|
|
dataTable.ajax.reload(); |
|
|
|
}); |
|
|
|
|
|
|
|
function checkHasBlogPostWaitingForReview(){ |
|
|
|
if (!abp.auth.isGranted('CmsKit.BlogPosts.Publish')){ |
|
|
|
$('#alertHasBlogPostWaitingForReview').hide(); |
|
|
|
} |
|
|
|
|
|
|
|
blogsService.hasBlogPostWaitingForReview().then(function (result) { |
|
|
|
if (result) { |
|
|
|
$('#alertHasBlogPostWaitingForReview').show('fast'); |
|
|
|
} else { |
|
|
|
$('#alertHasBlogPostWaitingForReview').hide('fast'); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
checkHasBlogPostWaitingForReview(); |
|
|
|
}); |
|
|
|
|