settings: Extract multiple versions of maybe_disable_widgets().

This commit is contained in:
Steve Howell
2018-12-08 16:37:57 +00:00
committed by Tim Abbott
parent b29d66f34b
commit b88a5700f6
5 changed files with 55 additions and 23 deletions

View File

@@ -5,29 +5,10 @@ var exports = {};
var is_loaded = new Dict(); // section -> bool
exports.maybe_disable_widgets = function () {
if (page_params.is_admin) {
return;
}
// Ideally we'd do this on a per-page basis, but there
// are some tactical advantages of having all this code
// in the same place.
$(".organization-box [data-name='organization-profile']")
.find("input, textarea, button, select").attr("disabled", true);
$(".organization-box [data-name='organization-settings']")
.find("input, textarea, button, select").attr("disabled", true);
$(".organization-box [data-name='organization-permissions']")
.find("input, textarea, button, select").attr("disabled", true);
$(".organization-box [data-name='auth-methods']")
.find("input, button, select, checked").attr("disabled", true);
$(".organization-box [data-name='default-streams-list']")
.find("input:not(.search), button, select").attr("disabled", true);
$(".organization-box [data-name='filter-settings']")
.find("input, button, select").attr("disabled", true);
$(".organization-box [data-name='profile-field-settings']")
.find("input, button, select").attr("disabled", true);
$(".control-label-disabled").addClass('enabled');
settings_org.maybe_disable_widgets();
settings_streams.maybe_disable_widgets();
settings_filters.maybe_disable_widgets();
settings_profile_fields.maybe_disable_widgets();
};
exports.load_admin_section = function (name) {