Skip to content
Snippets Groups Projects
Commit e910b377 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

handling boolean configuration values

parent 2235371b
No related branches found
No related tags found
1 merge request!198Resolve "Configurable default permissions"
...@@ -122,6 +122,12 @@ ConfigurationAdminPanel.prototype.optionToTableRow = function (option) { ...@@ -122,6 +122,12 @@ ConfigurationAdminPanel.prototype.optionToTableRow = function (option) {
editOption = "<input name='edit-" + option.getType() + "' value='" + value + "'/>"; editOption = "<input name='edit-" + option.getType() + "' value='" + value + "'/>";
} else if (option.getValueType() === "TEXT") { } else if (option.getValueType() === "TEXT") {
editOption = "<textarea name='edit-" + option.getType() + "'>" + xss(value) + "</textarea>"; editOption = "<textarea name='edit-" + option.getType() + "'>" + xss(value) + "</textarea>";
} else if (option.getValueType() === "BOOLEAN") {
var checked = "";
if (value.toLowerCase() === "true") {
checked = " checked ";
}
editOption = "<input type='checkbox' name='edit-" + option.getType() + "' " + checked + " />";
} else if (option.getValueType() === "COLOR") { } else if (option.getValueType() === "COLOR") {
editOption = "<div>" + editOption = "<div>" +
"<input class='minerva-color-input' name='edit-" + option.getType() + "' data='" + option.getType() + "' value='" + value + "'/>" + "<input class='minerva-color-input' name='edit-" + option.getType() + "' data='" + option.getType() + "' value='" + value + "'/>" +
...@@ -141,7 +147,17 @@ ConfigurationAdminPanel.prototype.saveOption = function (type) { ...@@ -141,7 +147,17 @@ ConfigurationAdminPanel.prototype.saveOption = function (type) {
var self = this; var self = this;
return ServerConnector.getConfiguration().then(function (configuration) { return ServerConnector.getConfiguration().then(function (configuration) {
var option = configuration.getOption(type); var option = configuration.getOption(type);
var value = $("[name='edit-" + type + "']", self.getElement()).val(); var element = $("[name='edit-" + type + "']", self.getElement());
var value;
if (element.is(':checkbox')) {
if (element.is(':checked')) {
value = "true";
} else {
value = "false";
}
} else {
value = element.val();
}
option.setValue(value); option.setValue(value);
return ServerConnector.updateConfigurationOption(option); return ServerConnector.updateConfigurationOption(option);
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment