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