mirror of https://github.com/abpframework/abp.git
7 changed files with 469 additions and 452 deletions
@ -0,0 +1,4 @@ |
|||
{ |
|||
"singleQuote": true, |
|||
"useTabs": true |
|||
} |
|||
@ -1,14 +1,12 @@ |
|||
var abp = abp || {}; |
|||
$(function () { |
|||
abp.modals.blogCreate = function () { |
|||
var initModal = function (publicApi, args) { |
|||
var $form = publicApi.getForm(); |
|||
abp.modals.blogCreate = function () { |
|||
var initModal = function (publicApi, args) { |
|||
var $form = publicApi.getForm(); |
|||
}; |
|||
|
|||
|
|||
}; |
|||
|
|||
return { |
|||
initModal: initModal |
|||
} |
|||
}; |
|||
}); |
|||
return { |
|||
initModal: initModal, |
|||
}; |
|||
}; |
|||
}); |
|||
|
|||
@ -1,14 +1,12 @@ |
|||
var abp = abp || {}; |
|||
$(function () { |
|||
abp.modals.blogEdit = function () { |
|||
var initModal = function (publicApi, args) { |
|||
var $form = publicApi.getForm(); |
|||
abp.modals.blogEdit = function () { |
|||
var initModal = function (publicApi, args) { |
|||
var $form = publicApi.getForm(); |
|||
}; |
|||
|
|||
|
|||
}; |
|||
|
|||
return { |
|||
initModal: initModal |
|||
} |
|||
}; |
|||
}); |
|||
return { |
|||
initModal: initModal, |
|||
}; |
|||
}; |
|||
}); |
|||
|
|||
@ -1,82 +1,88 @@ |
|||
$(function () { |
|||
var l = abp.localization.getResource('Blogging'); |
|||
var _createModal = new abp.ModalManager( |
|||
abp.appPath + 'Blogging/Admin/Blogs/Create' |
|||
); |
|||
var _editModal = new abp.ModalManager( |
|||
abp.appPath + 'Blogging/Admin/Blogs/Edit' |
|||
); |
|||
|
|||
var l = abp.localization.getResource('Blogging'); |
|||
var _createModal = new abp.ModalManager(abp.appPath + 'Blogging/Admin/Blogs/Create'); |
|||
var _editModal = new abp.ModalManager(abp.appPath + 'Blogging/Admin/Blogs/Edit'); |
|||
var _dataTable = $('#BlogsTable').DataTable( |
|||
abp.libs.datatables.normalizeConfiguration({ |
|||
processing: true, |
|||
serverSide: true, |
|||
paging: false, |
|||
info: false, |
|||
scrollX: true, |
|||
searching: false, |
|||
autoWidth: false, |
|||
scrollCollapse: true, |
|||
order: [[3, 'desc']], |
|||
ajax: abp.libs.datatables.createAjax( |
|||
volo.blogging.admin.blogManagement.getList |
|||
), |
|||
columnDefs: [ |
|||
{ |
|||
rowAction: { |
|||
items: [ |
|||
{ |
|||
text: l('Edit'), |
|||
visible: abp.auth.isGranted('Blogging.Blog.Update'), |
|||
action: function (data) { |
|||
_editModal.open({ |
|||
blogId: data.record.id, |
|||
}); |
|||
}, |
|||
}, |
|||
{ |
|||
text: l('Delete'), |
|||
visible: abp.auth.isGranted('Blogging.Blog.Delete'), |
|||
confirmMessage: function (data) { |
|||
return l('BlogDeletionWarningMessage'); |
|||
}, |
|||
action: function (data) { |
|||
volo.blogging.admin.blogManagement |
|||
.delete(data.record.id) |
|||
.then(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
}, |
|||
}, |
|||
], |
|||
}, |
|||
}, |
|||
{ |
|||
target: 1, |
|||
data: 'name', |
|||
}, |
|||
{ |
|||
target: 2, |
|||
data: 'shortName', |
|||
}, |
|||
{ |
|||
target: 3, |
|||
data: 'creationTime', |
|||
render: function (date) { |
|||
return date; |
|||
}, |
|||
}, |
|||
{ |
|||
target: 4, |
|||
data: 'description', |
|||
}, |
|||
], |
|||
}) |
|||
); |
|||
|
|||
var _dataTable = $('#BlogsTable').DataTable(abp.libs.datatables.normalizeConfiguration({ |
|||
processing: true, |
|||
serverSide: true, |
|||
paging: false, |
|||
info: false, |
|||
scrollX: true, |
|||
searching: false, |
|||
autoWidth: false, |
|||
scrollCollapse: true, |
|||
order: [[3, "desc"]], |
|||
ajax: abp.libs.datatables.createAjax(volo.blogging.admin.blogManagement.getList), |
|||
columnDefs: [ |
|||
{ |
|||
rowAction: { |
|||
items: |
|||
[ |
|||
{ |
|||
text: l('Edit'), |
|||
visible: abp.auth.isGranted('Blogging.Blog.Update'), |
|||
action: function (data) { |
|||
_editModal.open({ |
|||
blogId: data.record.id |
|||
}); |
|||
} |
|||
}, |
|||
{ |
|||
text: l('Delete'), |
|||
visible: abp.auth.isGranted('Blogging.Blog.Delete'), |
|||
confirmMessage: function (data) { return l('BlogDeletionWarningMessage') }, |
|||
action: function (data) { |
|||
volo.blogging.admin.blogManagement |
|||
.delete(data.record.id) |
|||
.then(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
} |
|||
} |
|||
] |
|||
} |
|||
}, |
|||
{ |
|||
target: 1, |
|||
data: "name" |
|||
}, |
|||
{ |
|||
target: 2, |
|||
data: "shortName" |
|||
}, |
|||
{ |
|||
target: 3, |
|||
data: "creationTime", |
|||
render: function (date) { |
|||
return date; |
|||
} |
|||
}, |
|||
{ |
|||
target: 4, |
|||
data: "description" |
|||
} |
|||
] |
|||
})); |
|||
$('#CreateNewBlogButtonId').click(function () { |
|||
_createModal.open(); |
|||
}); |
|||
|
|||
_createModal.onClose(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
|
|||
$("#CreateNewBlogButtonId").click(function () { |
|||
_createModal.open(); |
|||
}); |
|||
|
|||
_createModal.onClose(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
|
|||
_editModal.onResult(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
|
|||
_editModal.onResult(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
}); |
|||
|
|||
@ -1,170 +1,184 @@ |
|||
(function ($) { |
|||
|
|||
var l = abp.localization.getResource('Blogging'); |
|||
|
|||
var initSocialShareLinks = function () { |
|||
|
|||
var re = new RegExp(/^.*\//); |
|||
var rootUrl = re.exec(window.location.href); |
|||
|
|||
var pageHeader = $("#PostTitle").text(); |
|||
var blogName = $('#BlogFullName').attr('name'); |
|||
|
|||
$('#TwitterShareLink').attr('href', |
|||
'https://twitter.com/intent/tweet?text=' + encodeURI(pageHeader + " | " + blogName + " | " + window.location.href) |
|||
); |
|||
|
|||
$('#LinkedinShareLink').attr('href', |
|||
'https://www.linkedin.com/shareArticle?' |
|||
+ 'url=' + encodeURI(window.location.href) + '&' |
|||
+ 'mini=true&' |
|||
+ "summary=" + encodeURI(blogName) + '&' |
|||
+ "title=" + encodeURI(pageHeader) + '&' |
|||
+ "source=" + encodeURI(rootUrl) |
|||
); |
|||
|
|||
$('#EmailShareLink').attr('href', |
|||
'mailto:?' |
|||
+ 'body=' + encodeURI('I want you to look at ' + window.location.href) + '&' |
|||
+ "subject=" + encodeURI(pageHeader + ' | ' + blogName) + '&' |
|||
); |
|||
}; |
|||
|
|||
$('div .replyForm').hide(); |
|||
|
|||
$('div .editForm').hide(); |
|||
|
|||
$('form[class="editFormClass"]').submit(function (event) { |
|||
event.preventDefault(); |
|||
var form = $(this).serializeFormToObject(); |
|||
|
|||
$.ajax({ |
|||
type: "POST", |
|||
url: "/Blog/Comments/Update", |
|||
data: { |
|||
id: form.commentId, |
|||
commentDto: { |
|||
text: form.text |
|||
} |
|||
}, |
|||
success: function (response) { |
|||
$('div .editForm').hide(); |
|||
$('#' + form.commentId).text(form.text); |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
$('.editCancelButton').click(function (event) { |
|||
event.preventDefault(); |
|||
$('div .editForm').hide(); |
|||
}); |
|||
|
|||
$('.replyCancelButton').click(function (event) { |
|||
event.preventDefault(); |
|||
$('div .replyForm').hide(); |
|||
}); |
|||
|
|||
$('.replyLink').click(function (event) { |
|||
event.preventDefault(); |
|||
$('div .editForm').hide(); |
|||
var linkElement = $(this); |
|||
var replyCommentId = linkElement.attr('data-relpyid'); |
|||
|
|||
if (replyCommentId != '' && replyCommentId !== undefined) { |
|||
var div = linkElement.parent().next(); |
|||
|
|||
if (div.is(":hidden")) { |
|||
$('div .replyForm').hide(); |
|||
div.show(); |
|||
} else { |
|||
div.hide(); |
|||
} |
|||
return; |
|||
} |
|||
}); |
|||
|
|||
$('.deleteLink').click(function (event) { |
|||
event.preventDefault(); |
|||
var linkElement = $(this); |
|||
var deleteCommentId = linkElement.attr('data-deleteid'); |
|||
|
|||
if (deleteCommentId != '' && deleteCommentId !== undefined) { |
|||
abp.message.confirm( |
|||
l('CommentDeletionWarningMessage'), // TODO: localize
|
|||
l('Are you sure?'), |
|||
function (isConfirmed) { |
|||
if (isConfirmed) { |
|||
$.ajax({ |
|||
type: "POST", |
|||
url: "/Blog/Comments/Delete", |
|||
data: { id: deleteCommentId }, |
|||
success: function (response) { |
|||
linkElement.parent().parent().parent().remove(); |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
); |
|||
} |
|||
}); |
|||
|
|||
$('#DeletePostLink').click(function (event) { |
|||
event.preventDefault(); |
|||
var linkElement = $(this); |
|||
var deleteCommentId = linkElement.attr('data-postid'); |
|||
var blogShortName = linkElement.attr('data-blogShortName'); |
|||
|
|||
if (deleteCommentId != '' && deleteCommentId !== undefined) { |
|||
abp.message.confirm( |
|||
l('PostDeletionWarningMessage'), |
|||
l('AreYouSure'), |
|||
function (isConfirmed) { |
|||
if (isConfirmed) { |
|||
$.ajax({ |
|||
type: "POST", |
|||
url: "/Blog/Posts/Delete", |
|||
data: { id: deleteCommentId }, |
|||
success: function () { |
|||
var url = window.location.pathname; |
|||
var postNameBeginning = url.lastIndexOf('/'); |
|||
window.location.replace(url.substring(0, postNameBeginning)); |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
); |
|||
} |
|||
}); |
|||
|
|||
$('.updateLink').click(function (event) { |
|||
event.preventDefault(); |
|||
$('div .replyForm').hide(); |
|||
|
|||
var linkElement = $(this); |
|||
var updateCommentId = $(this).attr('data-updateid'); |
|||
|
|||
if (updateCommentId != '' && updateCommentId !== undefined) { |
|||
|
|||
var div = linkElement.parent().next().next(); |
|||
|
|||
if (div.is(":hidden")) { |
|||
$('div .editForm').hide(); |
|||
div.show(); |
|||
} else { |
|||
div.hide(); |
|||
} |
|||
return; |
|||
} |
|||
}); |
|||
|
|||
if ($('#FocusCommentId').val() != '00000000-0000-0000-0000-000000000000') { |
|||
$('html, body').animate({ |
|||
scrollTop: ($('#' + $('#FocusCommentId').val()).offset().top - 150) |
|||
}, 500); |
|||
} |
|||
|
|||
$(".post-content a[href^='http']").attr('target', '_blank'); |
|||
|
|||
initSocialShareLinks(); |
|||
|
|||
var l = abp.localization.getResource('Blogging'); |
|||
|
|||
var initSocialShareLinks = function () { |
|||
var re = new RegExp(/^.*\//); |
|||
var rootUrl = re.exec(window.location.href); |
|||
|
|||
var pageHeader = $('#PostTitle').text(); |
|||
var blogName = $('#BlogFullName').attr('name'); |
|||
|
|||
$('#TwitterShareLink').attr( |
|||
'href', |
|||
'https://twitter.com/intent/tweet?text=' + |
|||
encodeURI(pageHeader + ' | ' + blogName + ' | ' + window.location.href) |
|||
); |
|||
|
|||
$('#LinkedinShareLink').attr( |
|||
'href', |
|||
'https://www.linkedin.com/shareArticle?' + |
|||
'url=' + |
|||
encodeURI(window.location.href) + |
|||
'&' + |
|||
'mini=true&' + |
|||
'summary=' + |
|||
encodeURI(blogName) + |
|||
'&' + |
|||
'title=' + |
|||
encodeURI(pageHeader) + |
|||
'&' + |
|||
'source=' + |
|||
encodeURI(rootUrl) |
|||
); |
|||
|
|||
$('#EmailShareLink').attr( |
|||
'href', |
|||
'mailto:?' + |
|||
'body=' + |
|||
encodeURI('I want you to look at ' + window.location.href) + |
|||
'&' + |
|||
'subject=' + |
|||
encodeURI(pageHeader + ' | ' + blogName) + |
|||
'&' |
|||
); |
|||
}; |
|||
|
|||
$('div .replyForm').hide(); |
|||
|
|||
$('div .editForm').hide(); |
|||
|
|||
$('form[class="editFormClass"]').submit(function (event) { |
|||
event.preventDefault(); |
|||
var form = $(this).serializeFormToObject(); |
|||
|
|||
$.ajax({ |
|||
type: 'POST', |
|||
url: '/Blog/Comments/Update', |
|||
data: { |
|||
id: form.commentId, |
|||
commentDto: { |
|||
text: form.text, |
|||
}, |
|||
}, |
|||
success: function (response) { |
|||
$('div .editForm').hide(); |
|||
$('#' + form.commentId).text(form.text); |
|||
}, |
|||
}); |
|||
}); |
|||
|
|||
$('.editCancelButton').click(function (event) { |
|||
event.preventDefault(); |
|||
$('div .editForm').hide(); |
|||
}); |
|||
|
|||
$('.replyCancelButton').click(function (event) { |
|||
event.preventDefault(); |
|||
$('div .replyForm').hide(); |
|||
}); |
|||
|
|||
$('.replyLink').click(function (event) { |
|||
event.preventDefault(); |
|||
$('div .editForm').hide(); |
|||
var linkElement = $(this); |
|||
var replyCommentId = linkElement.attr('data-relpyid'); |
|||
|
|||
if (replyCommentId != '' && replyCommentId !== undefined) { |
|||
var div = linkElement.parent().next(); |
|||
|
|||
if (div.is(':hidden')) { |
|||
$('div .replyForm').hide(); |
|||
div.show(); |
|||
} else { |
|||
div.hide(); |
|||
} |
|||
return; |
|||
} |
|||
}); |
|||
|
|||
$('.deleteLink').click(function (event) { |
|||
event.preventDefault(); |
|||
var linkElement = $(this); |
|||
var deleteCommentId = linkElement.attr('data-deleteid'); |
|||
|
|||
if (deleteCommentId != '' && deleteCommentId !== undefined) { |
|||
abp.message.confirm( |
|||
l('CommentDeletionWarningMessage'), // TODO: localize
|
|||
l('Are you sure?'), |
|||
function (isConfirmed) { |
|||
if (isConfirmed) { |
|||
$.ajax({ |
|||
type: 'POST', |
|||
url: '/Blog/Comments/Delete', |
|||
data: { id: deleteCommentId }, |
|||
success: function (response) { |
|||
linkElement.parent().parent().parent().remove(); |
|||
}, |
|||
}); |
|||
} |
|||
} |
|||
); |
|||
} |
|||
}); |
|||
|
|||
$('#DeletePostLink').click(function (event) { |
|||
event.preventDefault(); |
|||
var linkElement = $(this); |
|||
var deleteCommentId = linkElement.attr('data-postid'); |
|||
var blogShortName = linkElement.attr('data-blogShortName'); |
|||
|
|||
if (deleteCommentId != '' && deleteCommentId !== undefined) { |
|||
abp.message.confirm( |
|||
l('PostDeletionWarningMessage'), |
|||
l('AreYouSure'), |
|||
function (isConfirmed) { |
|||
if (isConfirmed) { |
|||
$.ajax({ |
|||
type: 'POST', |
|||
url: '/Blog/Posts/Delete', |
|||
data: { id: deleteCommentId }, |
|||
success: function () { |
|||
var url = window.location.pathname; |
|||
var postNameBeginning = url.lastIndexOf('/'); |
|||
window.location.replace(url.substring(0, postNameBeginning)); |
|||
}, |
|||
}); |
|||
} |
|||
} |
|||
); |
|||
} |
|||
}); |
|||
|
|||
$('.updateLink').click(function (event) { |
|||
event.preventDefault(); |
|||
$('div .replyForm').hide(); |
|||
|
|||
var linkElement = $(this); |
|||
var updateCommentId = $(this).attr('data-updateid'); |
|||
|
|||
if (updateCommentId != '' && updateCommentId !== undefined) { |
|||
var div = linkElement.parent().next().next(); |
|||
|
|||
if (div.is(':hidden')) { |
|||
$('div .editForm').hide(); |
|||
div.show(); |
|||
} else { |
|||
div.hide(); |
|||
} |
|||
return; |
|||
} |
|||
}); |
|||
|
|||
if ($('#FocusCommentId').val() != '00000000-0000-0000-0000-000000000000') { |
|||
$('html, body').animate( |
|||
{ |
|||
scrollTop: $('#' + $('#FocusCommentId').val()).offset().top - 150, |
|||
}, |
|||
500 |
|||
); |
|||
} |
|||
|
|||
$(".post-content a[href^='http']").attr('target', '_blank'); |
|||
|
|||
initSocialShareLinks(); |
|||
})(jQuery); |
|||
|
|||
@ -1,67 +1,67 @@ |
|||
(function() { |
|||
function handleArrows() { |
|||
var herosWidth = $(".hero-articles").width(); |
|||
var arrowsPosition = (herosWidth / 2 - 90); |
|||
$(".owl-next").css("right", arrowsPosition); |
|||
$(".owl-prev").css("left", arrowsPosition); |
|||
} |
|||
(function () { |
|||
function handleArrows() { |
|||
var herosWidth = $('.hero-articles').width(); |
|||
var arrowsPosition = herosWidth / 2 - 90; |
|||
$('.owl-next').css('right', arrowsPosition); |
|||
$('.owl-prev').css('left', arrowsPosition); |
|||
} |
|||
|
|||
function handleImages() { |
|||
//if ($(window).width() > 767) {
|
|||
// $(".box-articles .img-container").each(function () {
|
|||
// var squareWidth = $(this).width();
|
|||
// $(this).css("height", squareWidth);
|
|||
// });
|
|||
//}
|
|||
//else {
|
|||
// $(".box-articles .img-container").css("height", "auto");
|
|||
//}
|
|||
} |
|||
function handleImages() { |
|||
//if ($(window).width() > 767) {
|
|||
// $(".box-articles .img-container").each(function () {
|
|||
// var squareWidth = $(this).width();
|
|||
// $(this).css("height", squareWidth);
|
|||
// });
|
|||
//}
|
|||
//else {
|
|||
// $(".box-articles .img-container").css("height", "auto");
|
|||
//}
|
|||
} |
|||
|
|||
function handleOwlCarousel() { |
|||
$('.hero-section .owl-carousel').owlCarousel({ |
|||
loop: true, |
|||
margin: 0, |
|||
nav: false, |
|||
dots: false, |
|||
//center: true,
|
|||
autoplay: true, |
|||
autoHeight: true, |
|||
autoplaySpeed: 1000, |
|||
items: 1, |
|||
}); |
|||
$('.card-article-container .owl-carousel').owlCarousel({ |
|||
loop: true, |
|||
margin: 0, |
|||
nav: false, |
|||
dots: false, |
|||
autoplay: true, |
|||
autoplaySpeed: 1000, |
|||
responsive: { |
|||
0: { |
|||
items: 1 |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
function handleOwlCarousel() { |
|||
$('.hero-section .owl-carousel').owlCarousel({ |
|||
loop: true, |
|||
margin: 0, |
|||
nav: false, |
|||
dots: false, |
|||
//center: true,
|
|||
autoplay: true, |
|||
autoHeight: true, |
|||
autoplaySpeed: 1000, |
|||
items: 1, |
|||
}); |
|||
$('.card-article-container .owl-carousel').owlCarousel({ |
|||
loop: true, |
|||
margin: 0, |
|||
nav: false, |
|||
dots: false, |
|||
autoplay: true, |
|||
autoplaySpeed: 1000, |
|||
responsive: { |
|||
0: { |
|||
items: 1, |
|||
}, |
|||
}, |
|||
}); |
|||
} |
|||
|
|||
$(function () { |
|||
handleImages(); |
|||
handleOwlCarousel(); |
|||
$(function () { |
|||
handleImages(); |
|||
handleOwlCarousel(); |
|||
|
|||
$(".nav-link").on("click", function () { |
|||
$(this).parent().parent(); |
|||
}); |
|||
$('.nav-link').on('click', function () { |
|||
$(this).parent().parent(); |
|||
}); |
|||
|
|||
$(window).resize(function () { |
|||
setTimeout(function () { |
|||
handleArrows(); |
|||
handleImages(); |
|||
}, 500); |
|||
}); |
|||
$(window).resize(function () { |
|||
setTimeout(function () { |
|||
handleArrows(); |
|||
handleImages(); |
|||
}, 500); |
|||
}); |
|||
|
|||
setTimeout(function () { |
|||
handleArrows(); |
|||
}, 500); |
|||
}); |
|||
})(); |
|||
setTimeout(function () { |
|||
handleArrows(); |
|||
}, 500); |
|||
}); |
|||
})(); |
|||
|
|||
Loading…
Reference in new issue