You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.2 KiB
35 lines
1.2 KiB
2 years ago
|
/**
|
||
|
* @fileoverview Javascript functions used in server user groups page
|
||
|
* @name Server User Groups
|
||
|
*
|
||
|
* @requires jQuery
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* Unbind all event handlers before tearing down a page
|
||
|
*/
|
||
|
AJAX.registerTeardown('server/user_groups.js', function () {
|
||
|
$('#deleteUserGroupModal').off('show.bs.modal');
|
||
|
});
|
||
|
/**
|
||
|
* Bind event handlers
|
||
|
*/
|
||
|
|
||
|
AJAX.registerOnload('server/user_groups.js', function () {
|
||
|
const deleteUserGroupModal = $('#deleteUserGroupModal');
|
||
|
deleteUserGroupModal.on('show.bs.modal', function (event) {
|
||
|
const userGroupName = $(event.relatedTarget).data('user-group');
|
||
|
this.querySelector('.modal-body').innerText = Functions.sprintf(Messages.strDropUserGroupWarning, Functions.escapeHtml(userGroupName));
|
||
|
});
|
||
|
deleteUserGroupModal.on('shown.bs.modal', function (event) {
|
||
|
const userGroupName = $(event.relatedTarget).data('user-group');
|
||
|
$('#deleteUserGroupConfirm').on('click', function () {
|
||
|
$.post('index.php?route=/server/user-groups', {
|
||
|
'deleteUserGroup': true,
|
||
|
'userGroup': userGroupName,
|
||
|
'ajax_request': true
|
||
|
}, AJAX.responseHandler);
|
||
|
$('#deleteUserGroupModal').modal('hide');
|
||
|
});
|
||
|
});
|
||
|
});
|