2021-08-17 14:43:29 +02:00
|
|
|
import $ from "jquery";
|
|
|
|
|
2021-09-16 19:18:39 +02:00
|
|
|
import {page_params} from "./page_params";
|
2021-08-17 14:43:29 +02:00
|
|
|
import {realm_user_settings_defaults} from "./realm_user_settings_defaults";
|
|
|
|
import * as settings_display from "./settings_display";
|
2021-08-26 21:03:27 +02:00
|
|
|
import * as settings_notifications from "./settings_notifications";
|
2021-08-17 14:43:29 +02:00
|
|
|
|
2021-09-16 19:18:39 +02:00
|
|
|
export function maybe_disable_widgets() {
|
|
|
|
if (!page_params.is_admin) {
|
|
|
|
$(".organization-box [data-name='organization-level-user-defaults']")
|
|
|
|
.find("input, select")
|
|
|
|
.prop("disabled", true);
|
|
|
|
|
|
|
|
$(".organization-box [data-name='organization-level-user-defaults']")
|
|
|
|
.find(".play_notification_sound")
|
|
|
|
.addClass("control-label-disabled");
|
|
|
|
}
|
|
|
|
}
|
2021-08-17 14:43:29 +02:00
|
|
|
export function set_up() {
|
|
|
|
const container = $("#realm-user-default-settings");
|
|
|
|
settings_display.set_up(container, realm_user_settings_defaults, true);
|
2021-08-26 21:03:27 +02:00
|
|
|
settings_notifications.set_up(container, realm_user_settings_defaults, true);
|
2021-09-16 19:18:39 +02:00
|
|
|
maybe_disable_widgets();
|
2021-08-17 14:43:29 +02:00
|
|
|
}
|