mirror of https://github.com/zulip/zulip.git
org settings: Refactor code for get_property_value.
This just makes the code for getting the property value more readable and less confusing.
This commit is contained in:
parent
a06c7bc247
commit
9aa9ed9472
|
@ -115,7 +115,7 @@ function get_property_value(property_name) {
|
||||||
}
|
}
|
||||||
return "by_anyone";
|
return "by_anyone";
|
||||||
}
|
}
|
||||||
return;
|
return page_params[property_name];
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.extract_property_name = function (elem) {
|
exports.extract_property_name = function (elem) {
|
||||||
|
@ -286,12 +286,7 @@ function update_dependent_subsettings(property_name) {
|
||||||
function discard_property_element_changes(elem) {
|
function discard_property_element_changes(elem) {
|
||||||
elem = $(elem);
|
elem = $(elem);
|
||||||
var property_name = exports.extract_property_name(elem);
|
var property_name = exports.extract_property_name(elem);
|
||||||
// Check whether the id refers to a property whose name we can't
|
|
||||||
// extract from element's id.
|
|
||||||
var property_value = get_property_value(property_name);
|
var property_value = get_property_value(property_name);
|
||||||
if (property_value === undefined) {
|
|
||||||
property_value = page_params[property_name];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof property_value === 'boolean') {
|
if (typeof property_value === 'boolean') {
|
||||||
elem.prop('checked', property_value);
|
elem.prop('checked', property_value);
|
||||||
|
@ -420,12 +415,7 @@ function _set_up() {
|
||||||
elem = $(elem);
|
elem = $(elem);
|
||||||
var property_name = exports.extract_property_name(elem);
|
var property_name = exports.extract_property_name(elem);
|
||||||
var changed_val;
|
var changed_val;
|
||||||
// Check whether the id refers to a property whose name we can't
|
|
||||||
// extract from element's id.
|
|
||||||
var current_val = get_property_value(property_name);
|
var current_val = get_property_value(property_name);
|
||||||
if (current_val === undefined) {
|
|
||||||
current_val = page_params[property_name];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof current_val === 'boolean') {
|
if (typeof current_val === 'boolean') {
|
||||||
changed_val = elem.prop('checked');
|
changed_val = elem.prop('checked');
|
||||||
|
|
Loading…
Reference in New Issue