mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 19:22:57 +02:00
handle select inputs in domain server settings creation
This commit is contained in:
parent
b6fba04d4f
commit
a4b4fc52b6
1 changed files with 23 additions and 3 deletions
|
@ -33,9 +33,24 @@ var viewHelpers = {
|
||||||
input_type = _.has(setting, 'type') ? setting.type : "text"
|
input_type = _.has(setting, 'type') ? setting.type : "text"
|
||||||
|
|
||||||
form_group += "<label for='" + setting_name + "' class='" + label_class + "'>" + setting.label + "</label>";
|
form_group += "<label for='" + setting_name + "' class='" + label_class + "'>" + setting.label + "</label>";
|
||||||
|
|
||||||
|
if (setting.type === 'select') {
|
||||||
|
form_group += "<select class='form-control' data-hidden-input='" + setting_name + "'>'"
|
||||||
|
|
||||||
|
_.each(setting.options, function(option) {
|
||||||
|
form_group += "<option value='" + option.value + "'" +
|
||||||
|
(option.value == setting_value ? 'selected' : '') + ">" + option.label + "</option>"
|
||||||
|
})
|
||||||
|
|
||||||
|
form_group += "</select>"
|
||||||
|
|
||||||
|
form_group += "<input type='hidden' name='" + setting_name + "' value='" + setting_value + "'>"
|
||||||
|
} else {
|
||||||
form_group += "<input type='" + input_type + "' class='form-control' name='" + setting_name +
|
form_group += "<input type='" + input_type + "' class='form-control' name='" + setting_name +
|
||||||
"' placeholder='" + (_.has(setting, 'placeholder') ? setting.placeholder : "") +
|
"' placeholder='" + (_.has(setting, 'placeholder') ? setting.placeholder : "") +
|
||||||
"' value='" + setting_value + "'" + (isLocked ? " disabled" : "") + "/>"
|
"' value='" + setting_value + "'" + (isLocked ? " disabled" : "") + "/>"
|
||||||
|
}
|
||||||
|
|
||||||
form_group += "<span class='help-block'>" + setting.help + "</span>"
|
form_group += "<span class='help-block'>" + setting.help + "</span>"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +106,11 @@ $(document).ready(function(){
|
||||||
chooseFromHighFidelityDomains($(this))
|
chooseFromHighFidelityDomains($(this))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$('#settings-form').on('change', 'select', function(){
|
||||||
|
console.log("Changed" + $(this))
|
||||||
|
$("input[name='" + $(this).attr('data-hidden-input') + "']").val($(this).val()).change()
|
||||||
|
})
|
||||||
|
|
||||||
var panelsSource = $('#panels-template').html()
|
var panelsSource = $('#panels-template').html()
|
||||||
Settings.panelsTemplate = _.template(panelsSource)
|
Settings.panelsTemplate = _.template(panelsSource)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue