65 lines
1.9 KiB
JavaScript
65 lines
1.9 KiB
JavaScript
$(document).on('turbolinks:load', function(){
|
|
if ($('body.admins-organizations-index-page').length > 0) {
|
|
var showSuccessNotify = function() {
|
|
$.notify({
|
|
message: '操作成功'
|
|
},{
|
|
type: 'success'
|
|
});
|
|
}
|
|
|
|
// organizations open cla
|
|
$('.organizations-list-container').on('click', '.open-cla-action', function(){
|
|
var $openClaAction = $(this);
|
|
var $closeClaAction = $openClaAction.siblings('.close-cla-action');
|
|
|
|
var userId = $openClaAction.data('id');
|
|
customConfirm({
|
|
content: '确认开通吗?',
|
|
ok: function () {
|
|
$.ajax({
|
|
url: '/admins/organizations/' + userId + '/open_cla',
|
|
method: 'POST',
|
|
dataType: 'json',
|
|
success: function() {
|
|
showSuccessNotify();
|
|
$closeClaAction.show();
|
|
$openClaAction.hide();
|
|
},
|
|
error: function(res){
|
|
$.notify({ message: res.responseJSON.message }, { type: 'danger' });
|
|
}
|
|
});
|
|
}
|
|
})
|
|
});
|
|
|
|
// organizations close cla
|
|
$('.organizations-list-container').on('click', '.close-cla-action', function(){
|
|
var $closeClaAction = $(this);
|
|
var $openClaAction= $closeClaAction.siblings('.open-cla-action');
|
|
|
|
var userId = $openClaAction.data('id');
|
|
customConfirm({
|
|
content: '确认关闭吗?',
|
|
ok: function () {
|
|
$.ajax({
|
|
url: '/admins/organizations/' + userId + '/close_cla',
|
|
method: 'POST',
|
|
dataType: 'json',
|
|
success: function() {
|
|
showSuccessNotify();
|
|
$openClaAction.show();
|
|
$closeClaAction.hide();
|
|
},
|
|
error: function(res){
|
|
$.notify({ message: res.responseJSON.message }, { type: 'danger' });
|
|
}
|
|
});
|
|
}
|
|
})
|
|
});
|
|
|
|
|
|
}
|
|
}); |