This commit is contained in:
2017-10-22 19:16:14 +02:00
parent f316ce472d
commit 07d3895e6d
2 changed files with 29 additions and 26 deletions

View File

@ -68,6 +68,14 @@ h6 {
<style>
nav { background: url(@Startup.SiteSetup.Banner) 0% 50% no-repeat; }
</style>
<script>
$(document).ready(function() {
if (typeof allowCircleToBlog !== "undefined") {
$('input.Blogcirle[type=checkbox]').on('change', allowCircleToBlog);
}
});
</script>
@RenderSection("header", required: false)
</head>
<body>

View File

@ -1,27 +1,22 @@
+(function($) {
var allowCircleToBlog = function(e) {
var allow = $(this).prop('checked');
var circleid = $(this).data('circle-id');
var targetid = $(this).data('target-id');
var auth = { CircleId: circleid, BlogPostId: targetid };
var url = '/api/blogacl';
if (!allow) url += '/' + circleid;
console.log(auth);
$.ajax({
url: url,
type: allow ? 'POST' : 'DELETE',
data: JSON.stringify(auth),
contentType: "application/json;charset=utf-8",
success: function(data) {
console.log('auth ' + allow ? 'POSTED' : 'DELETED' + data);
},
error: function() {
console.log('Error @' + allow ? 'POSTed' : 'DELETEd');
}
});
e.preventDefault();
};
$(document).ready(function() {
$('input.Blogcirle[type=checkbox]').on('change', allowCircleToBlog);
var allowCircleToBlog = function(e) {
var allow = $(this).prop('checked');
var circleid = $(this).data('circle-id');
var targetid = $(this).data('target-id');
var auth = { CircleId: circleid, BlogPostId: targetid };
var url = '/api/blogacl';
if (!allow) url += '/' + circleid;
console.log(auth);
$.ajax({
url: url,
type: allow ? 'POST' : 'DELETE',
data: JSON.stringify(auth),
contentType: "application/json;charset=utf-8",
success: function(data) {
console.log('auth ' + allow ? 'POSTED' : 'DELETED' + data);
},
error: function() {
console.log('Error @' + allow ? 'POSTed' : 'DELETEd');
}
});
})(jQuery);
e.preventDefault();
}