diff --git a/frontend-js/src/main/js/gui/admin/ConfigurationAdminPanel.js b/frontend-js/src/main/js/gui/admin/ConfigurationAdminPanel.js index 1da686d8b1db6c00ac77cd864aa74c111e91737e..eb25b190e10681c254761cb8b58c5b072e7a0af0 100644 --- a/frontend-js/src/main/js/gui/admin/ConfigurationAdminPanel.js +++ b/frontend-js/src/main/js/gui/admin/ConfigurationAdminPanel.js @@ -122,6 +122,12 @@ ConfigurationAdminPanel.prototype.optionToTableRow = function (option) { editOption = "<input name='edit-" + option.getType() + "' value='" + value + "'/>"; } else if (option.getValueType() === "TEXT") { 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") { editOption = "<div>" + "<input class='minerva-color-input' name='edit-" + option.getType() + "' data='" + option.getType() + "' value='" + value + "'/>" + @@ -141,7 +147,17 @@ ConfigurationAdminPanel.prototype.saveOption = function (type) { var self = this; return ServerConnector.getConfiguration().then(function (configuration) { 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); return ServerConnector.updateConfigurationOption(option); });