blob: 6810b730f9cdfbd06027a7f3398053650fcc78ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/**
* @fileoverview Javascript functions used in server user groups page
* @name Server User Groups
*
* @requires jQuery
*/
/**
* Unbind all event handlers before tearing down a page
*/
window.AJAX.registerTeardown('server/user_groups.js', function () {
$('#deleteUserGroupModal').off('show.bs.modal');
});
/**
* Bind event handlers
*/
window.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(
window.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,
},
window.AJAX.responseHandler
);
$('#deleteUserGroupModal').modal('hide');
});
});
});
|