Ajoute ou supprime des cercle aux posts

This commit is contained in:
2017-01-21 22:36:43 +01:00
parent 1268411e29
commit 4fb1c297d9
19 changed files with 199 additions and 67 deletions

File diff suppressed because one or more lines are too long

View File

@ -1 +1,29 @@
// Write your Javascript code.
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'+' Successfully');
},
error: function () {
console.log('auth not '+allow?'POSTed':'DELETEd');
}
});
e.preventDefault();
};
$(document).ready(function(){
$('input.Blogcirle[type=checkbox]').on('change',allowCircleToBlog);
}
);