move some more settings to content, leave places in domain settings

This commit is contained in:
Stephen Birarda 2018-01-30 16:38:32 -08:00
parent 6240181474
commit b0967dfc3a
5 changed files with 33 additions and 7 deletions

View file

@ -55,8 +55,8 @@
]
},
{
"label": "Places / Paths",
"html_id": "places_paths",
"label": "Paths",
"html_id": "paths",
"restart": false,
"settings": [
{
@ -64,6 +64,7 @@
"label": "Paths",
"help": "Clients can enter a path to reach an exact viewpoint in your domain.<br/>Add rows to the table below to map a path to a viewpoint.<br/>The index path ( / ) is where clients will enter if they do not enter an explicit path.",
"type": "table",
"content_setting": true,
"can_add_new_rows": true,
"key": {
"name": "path",
@ -1081,6 +1082,7 @@
"name": "attenuation_per_doubling_in_distance",
"label": "Default Domain Attenuation",
"help": "Factor between 0 and 1.0 (0: No attenuation, 1.0: extreme attenuation)",
"content_setting": true,
"placeholder": "0.5",
"default": "0.5",
"advanced": false
@ -1313,6 +1315,7 @@
"name": "entityEditFilter",
"label": "Filter Entity Edits",
"help": "Check all entity edits against this filter function.",
"content_setting": true,
"placeholder": "url whose content is like: function filter(properties) { return properties; }",
"default": "",
"advanced": true

View file

@ -94,9 +94,13 @@ var viewHelpers = {
function reloadSettings(callback) {
$.getJSON(Settings.endpoint, function(data){
_.extend(data, viewHelpers)
_.extend(data, viewHelpers);
$('#panels').html(Settings.panelsTemplate(data))
for (var spliceIndex in Settings.extraGroups) {
data.descriptions.splice(spliceIndex, 0, Settings.extraGroups[spliceIndex]);
}
$('#panels').html(Settings.panelsTemplate(data));
Settings.data = data;
Settings.initialValues = form2js('settings-form', ".", false, cleanupFormValues, true);

View file

@ -79,6 +79,13 @@ $(document).ready(function(){
}
$settingsDropdown.append(makeGroupDropdownElement(group, "/settings/"));
// for domain settings, we add a dummy "Places" group that we fill
// via the API - add it to the dropdown menu in the right spot
if (index == 1) {
$settingsDropdown.append("<li role='separator' class='divider'></li>");
$settingsDropdown.append(makeGroupDropdownElement({ html_id: 'places', label: 'Places' }, "/settings/"));
}
});
});
}

View file

@ -14,6 +14,14 @@ $(document).ready(function(){
return b;
})(window.location.search.substr(1).split('&'));
// define extra groups to add to description, with their splice index
Settings.extraGroups = {
1: {
html_id: 'places',
label: 'Places'
}
}
Settings.afterReloadActions = function() {
// append the domain selection modal
appendDomainIDButtons();
@ -657,8 +665,7 @@ $(document).ready(function(){
var placesTableGroup = viewHelpers.getFormGroup('', placesTableSetting, Settings.data.values);
// append the places table in the right place
$('#places_paths .panel-body').prepend(placesTableGroup);
//$('#' + Settings.PLACES_TABLE_ID).append("<tr><td colspan=3></td></tr>");
$('#places .panel-body').prepend(placesTableGroup);
var spinner = createDomainSpinner();
$('#' + Settings.PLACES_TABLE_ID).after($(spinner));

View file

@ -123,7 +123,10 @@ void DomainServerSettingsManager::splitSettingsDescription() {
QJsonObject settingsDropdownGroup;
if (!groupHidden) {
settingsDropdownGroup[DESCRIPTION_NAME_KEY] = groupObject[DESCRIPTION_NAME_KEY];
if (groupObject.contains(DESCRIPTION_NAME_KEY)) {
settingsDropdownGroup[DESCRIPTION_NAME_KEY] = groupObject[DESCRIPTION_NAME_KEY];
}
settingsDropdownGroup[DESCRIPTION_GROUP_LABEL_KEY] = groupObject[DESCRIPTION_GROUP_LABEL_KEY];
static const QString DESCRIPTION_GROUP_HTML_ID_KEY = "html_id";
@ -1383,7 +1386,9 @@ bool DomainServerSettingsManager::recurseJSONObjectAndOverwriteSettings(const QJ
foreach(const QJsonValue& groupValue, _descriptionArray) {
// find groups with root values (they don't have a group name)
QJsonObject groupObject = groupValue.toObject();
if (!groupObject.contains(DESCRIPTION_NAME_KEY)) {
// this is a group with root values - check if our setting is in here
matchingDescriptionObject = settingDescriptionFromGroup(groupObject, rootKey);