2020-09-27 16:36:33 +00:00
|
|
|
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later
|
2017-12-02 03:33:04 +00:00
|
|
|
/**
|
2020-01-19 06:05:23 +00:00
|
|
|
* Javascript for the admin module
|
2017-12-02 03:33:04 +00:00
|
|
|
*/
|
|
|
|
$(function() {
|
2020-06-12 00:26:29 +00:00
|
|
|
let $body = $('body');
|
|
|
|
$body.on('click', '.selectall', function() {
|
2017-12-02 03:33:04 +00:00
|
|
|
selectall($(this).data('selectAll'));
|
|
|
|
});
|
2020-06-12 00:26:29 +00:00
|
|
|
$body.on('click', '.selectnone', function() {
|
2017-12-02 03:33:04 +00:00
|
|
|
selectnone($(this).data('selectNone'));
|
|
|
|
});
|
|
|
|
|
2018-04-22 18:23:24 +00:00
|
|
|
// Toggle checkbox status to all or none for all checkboxes of a specific
|
|
|
|
// css class.
|
2020-06-12 00:26:29 +00:00
|
|
|
$body.on('change', 'input[type=checkbox].selecttoggle', function() {
|
2017-12-02 03:33:04 +00:00
|
|
|
$this = $(this);
|
|
|
|
if ($this.prop('checked')) {
|
|
|
|
selectall($this.data('selectClass'));
|
|
|
|
$this.attr('title', $this.data('selectNone'));
|
|
|
|
} else {
|
|
|
|
selectnone($this.data('selectClass'));
|
|
|
|
$this.attr('title', $this.data('selectAll'));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-04-19 16:17:46 +00:00
|
|
|
function selectall(cls) {
|
|
|
|
$('.' + cls).prop('checked', true);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
function selectnone(cls) {
|
|
|
|
$('.' + cls).prop('checked', false);
|
|
|
|
return false;
|
|
|
|
}
|
2018-04-18 19:43:33 +00:00
|
|
|
|
|
|
|
|
2018-04-19 16:17:46 +00:00
|
|
|
});
|
|
|
|
|
2018-04-18 19:43:33 +00:00
|
|
|
// Users
|
2018-04-19 16:17:46 +00:00
|
|
|
function confirm_delete(msg, uname){
|
|
|
|
return confirm(msg.format(uname));
|
2018-04-18 19:43:33 +00:00
|
|
|
}
|
2018-04-19 16:17:46 +00:00
|
|
|
|
2018-04-18 19:43:33 +00:00
|
|
|
function details(uid) {
|
2018-04-22 18:23:24 +00:00
|
|
|
$("#user-" + uid + "-detail").toggleClass("hidden");
|
|
|
|
$("#user-" + uid).toggleClass("opened");
|
2018-04-18 19:43:33 +00:00
|
|
|
return false;
|
|
|
|
}
|
2020-09-27 16:36:33 +00:00
|
|
|
// @license-end
|