mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
Merge pull request #3618 from birarda/master
styling fixes for locked table settings in domain-server
This commit is contained in:
commit
af9090cadf
2 changed files with 54 additions and 37 deletions
|
@ -53,7 +53,12 @@ span.port {
|
||||||
}
|
}
|
||||||
|
|
||||||
.locked {
|
.locked {
|
||||||
color: blue;
|
color: #428bca;
|
||||||
|
}
|
||||||
|
|
||||||
|
.locked-table {
|
||||||
|
cursor: not-allowed;
|
||||||
|
background-color: #eee;
|
||||||
}
|
}
|
||||||
|
|
||||||
.advanced-setting {
|
.advanced-setting {
|
||||||
|
|
|
@ -41,6 +41,7 @@ var viewHelpers = {
|
||||||
|
|
||||||
common_attrs = " class='" + (setting.type !== 'checkbox' ? 'form-control' : '')
|
common_attrs = " class='" + (setting.type !== 'checkbox' ? 'form-control' : '')
|
||||||
+ " " + Settings.TRIGGER_CHANGE_CLASS + "' data-short-name='" + setting.name + "' name='" + setting_name + "' "
|
+ " " + Settings.TRIGGER_CHANGE_CLASS + "' data-short-name='" + setting.name + "' name='" + setting_name + "' "
|
||||||
|
+ "id='" + setting_name + "'"
|
||||||
|
|
||||||
if (setting.type === 'checkbox') {
|
if (setting.type === 'checkbox') {
|
||||||
if (setting.label) {
|
if (setting.label) {
|
||||||
|
@ -51,8 +52,6 @@ var viewHelpers = {
|
||||||
form_group += "<input type='checkbox'" + common_attrs + (setting_value ? "checked" : "") + (isLocked ? " disabled" : "") + "/>"
|
form_group += "<input type='checkbox'" + common_attrs + (setting_value ? "checked" : "") + (isLocked ? " disabled" : "") + "/>"
|
||||||
form_group += " " + setting.help + "</label>";
|
form_group += " " + setting.help + "</label>";
|
||||||
form_group += "</div>"
|
form_group += "</div>"
|
||||||
} else if (setting.type === 'table') {
|
|
||||||
form_group += makeTable(setting, setting_name, setting_value);
|
|
||||||
} else {
|
} else {
|
||||||
input_type = _.has(setting, 'type') ? setting.type : "text"
|
input_type = _.has(setting, 'type') ? setting.type : "text"
|
||||||
|
|
||||||
|
@ -60,29 +59,33 @@ var viewHelpers = {
|
||||||
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') {
|
if (input_type === 'table') {
|
||||||
form_group += "<select class='form-control' data-hidden-input='" + setting_name + "'>'"
|
form_group += makeTable(setting, setting_name, setting_value, isLocked)
|
||||||
|
|
||||||
_.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'" + common_attrs + "value='" + setting_value + "'>"
|
|
||||||
} else {
|
} else {
|
||||||
|
if (input_type === 'select') {
|
||||||
|
form_group += "<select class='form-control' data-hidden-input='" + setting_name + "'>'"
|
||||||
|
|
||||||
if (input_type == 'integer') {
|
_.each(setting.options, function(option) {
|
||||||
input_type = "text"
|
form_group += "<option value='" + option.value + "'" +
|
||||||
|
(option.value == setting_value ? 'selected' : '') + ">" + option.label + "</option>"
|
||||||
|
})
|
||||||
|
|
||||||
|
form_group += "</select>"
|
||||||
|
|
||||||
|
form_group += "<input type='hidden'" + common_attrs + "value='" + setting_value + "'>"
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (input_type == 'integer') {
|
||||||
|
input_type = "text"
|
||||||
|
}
|
||||||
|
|
||||||
|
form_group += "<input type='" + input_type + "'" + common_attrs +
|
||||||
|
"placeholder='" + (_.has(setting, 'placeholder') ? setting.placeholder : "") +
|
||||||
|
"' value='" + setting_value + "'" + (isLocked ? " disabled" : "") + "/>"
|
||||||
}
|
}
|
||||||
|
|
||||||
form_group += "<input type='" + input_type + "'" + common_attrs +
|
|
||||||
"placeholder='" + (_.has(setting, 'placeholder') ? setting.placeholder : "") +
|
|
||||||
"' value='" + setting_value + "'" + (isLocked ? " disabled" : "") + "/>"
|
|
||||||
}
|
|
||||||
|
|
||||||
form_group += "<span class='help-block'>" + setting.help + "</span>"
|
form_group += "<span class='help-block'>" + setting.help + "</span>"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
form_group += "</div>"
|
form_group += "</div>"
|
||||||
|
@ -201,7 +204,10 @@ function reloadSettings() {
|
||||||
title: 'This setting is in the master config file and cannot be changed'
|
title: 'This setting is in the master config file and cannot be changed'
|
||||||
})
|
})
|
||||||
|
|
||||||
appendDomainSelectionModal()
|
if (!_.has(data["locked"], "metaverse") && !_.has(data["locked"]["metaverse"], "id")) {
|
||||||
|
// append the domain selection modal, as long as it's not locked
|
||||||
|
appendDomainSelectionModal()
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,16 +258,15 @@ $('body').on('click', '.save-button', function(e){
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
function makeTable(setting, setting_name, setting_value) {
|
function makeTable(setting, setting_name, setting_value, isLocked) {
|
||||||
var isArray = !_.has(setting, 'key')
|
var isArray = !_.has(setting, 'key')
|
||||||
|
|
||||||
if (!isArray && setting.can_order) {
|
if (!isArray && setting.can_order) {
|
||||||
setting.can_order = false;
|
setting.can_order = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var html = (setting.label) ? "<label class='control-label'>" + setting.label + "</label>" : ""
|
var html = "<span class='help-block'>" + setting.help + "</span>"
|
||||||
html += "<span class='help-block'>" + setting.help + "</span>"
|
html += "<table class='table table-bordered " + (isLocked ? "locked-table" : "") + "' data-short-name='" + setting.name + "' name='" + setting_name
|
||||||
html += "<table class='table table-bordered' data-short-name='" + setting.name + "' name='" + setting_name
|
|
||||||
+ "' data-setting-type='" + (isArray ? 'array' : 'hash') + "'>"
|
+ "' data-setting-type='" + (isArray ? 'array' : 'hash') + "'>"
|
||||||
|
|
||||||
// Column names
|
// Column names
|
||||||
|
@ -279,11 +284,13 @@ function makeTable(setting, setting_name, setting_value) {
|
||||||
html += "<td class='data'><strong>" + col.label + "</strong></td>" // Data
|
html += "<td class='data'><strong>" + col.label + "</strong></td>" // Data
|
||||||
})
|
})
|
||||||
|
|
||||||
if (setting.can_order) {
|
if (!isLocked) {
|
||||||
html += "<td class=" + Settings.REORDER_BUTTONS_CLASSES +
|
if (setting.can_order) {
|
||||||
"><span class='glyphicon glyphicon-sort'></span></td>";
|
html += "<td class=" + Settings.REORDER_BUTTONS_CLASSES +
|
||||||
}
|
"><span class='glyphicon glyphicon-sort'></span></td>";
|
||||||
|
}
|
||||||
html += "<td class=" + Settings.ADD_DEL_BUTTONS_CLASSES + "></td></tr>"
|
html += "<td class=" + Settings.ADD_DEL_BUTTONS_CLASSES + "></td></tr>"
|
||||||
|
}
|
||||||
|
|
||||||
// populate rows in the table from existing values
|
// populate rows in the table from existing values
|
||||||
var row_num = 1
|
var row_num = 1
|
||||||
|
@ -317,20 +324,25 @@ function makeTable(setting, setting_name, setting_value) {
|
||||||
html += "</td>"
|
html += "</td>"
|
||||||
})
|
})
|
||||||
|
|
||||||
if (setting.can_order) {
|
if (!isLocked) {
|
||||||
html += "<td class='" + Settings.REORDER_BUTTONS_CLASSES+
|
if (setting.can_order) {
|
||||||
"'><span class='" + Settings.MOVE_UP_SPAN_CLASSES + "'></span><span class='" +
|
html += "<td class='" + Settings.REORDER_BUTTONS_CLASSES+
|
||||||
Settings.MOVE_DOWN_SPAN_CLASSES + "'></span></td>"
|
"'><span class='" + Settings.MOVE_UP_SPAN_CLASSES + "'></span><span class='" +
|
||||||
}
|
Settings.MOVE_DOWN_SPAN_CLASSES + "'></span></td>"
|
||||||
|
}
|
||||||
html += "<td class='" + Settings.ADD_DEL_BUTTONS_CLASSES +
|
html += "<td class='" + Settings.ADD_DEL_BUTTONS_CLASSES +
|
||||||
"'><span class='" + Settings.DEL_ROW_SPAN_CLASSES + "'></span></td>"
|
"'><span class='" + Settings.DEL_ROW_SPAN_CLASSES + "'></span></td>"
|
||||||
|
}
|
||||||
|
|
||||||
html += "</tr>"
|
html += "</tr>"
|
||||||
|
|
||||||
row_num++
|
row_num++
|
||||||
})
|
})
|
||||||
|
|
||||||
// populate inputs in the table for new values
|
// populate inputs in the table for new values
|
||||||
html += makeTableInputs(setting)
|
if (!isLocked) {
|
||||||
|
html += makeTableInputs(setting)
|
||||||
|
}
|
||||||
html += "</table>"
|
html += "</table>"
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
|
|
Loading…
Reference in a new issue