Add tooltips; cleanup

This commit is contained in:
Harvey Tindall 2020-06-30 18:57:04 +01:00
parent eb8e04d5a2
commit 8e94f04d5a
2 changed files with 17 additions and 7 deletions

View File

@ -291,7 +291,8 @@ document.getElementById('openDefaultsWizard').onclick = function () {
} else if (submitButton.classList.contains('btn-danger')) { } else if (submitButton.classList.contains('btn-danger')) {
submitButton.classList.remove('btn-danger'); submitButton.classList.remove('btn-danger');
submitButton.classList.add('btn-primary'); submitButton.classList.add('btn-primary');
} };
$('#settingsMenu').modal('hide');
$('#userDefaults').modal('show'); $('#userDefaults').modal('show');
} }
} }
@ -440,6 +441,7 @@ document.getElementById('openUsers').onclick = function () {
var button = document.getElementById('openUsers'); var button = document.getElementById('openUsers');
button.disabled = false; button.disabled = false;
button.innerHTML = 'Users <i class="fa fa-user"></i>'; button.innerHTML = 'Users <i class="fa fa-user"></i>';
$('#settingsMenu').modal('hide');
$('#users').modal('show'); $('#users').modal('show');
}; };
} }
@ -496,6 +498,13 @@ document.getElementById('openSettings').onclick = function () {
entryName += ' <sup class="text-danger">*</sup>'; entryName += ' <sup class="text-danger">*</sup>';
required = true; required = true;
}; };
if (config[section][entry].hasOwnProperty('description')) {
var tooltip = `
<a class="text-muted" href="#" data-toggle="tooltip" data-placement="right" title="${config[section][entry]['description']}"><i class="fa fa-question-circle-o"></i></a>
`;
entryName += ' ';
entryName += tooltip;
};
// if (config[section][entry]['requires_restart']) { // if (config[section][entry]['requires_restart']) {
// entryName += ' <sup class="text-danger">R</sup>'; // entryName += ' <sup class="text-danger">R</sup>';
// }; // };
@ -575,6 +584,12 @@ document.getElementById('openSettings').onclick = function () {
$('#settingsMenu').modal('show'); $('#settingsMenu').modal('show');
}; };
$('#settingsMenu').on('shown.bs.modal', function() {
$("a[data-toggle='tooltip']").each(function (i, obj) {
$(obj).tooltip();
});
});
function sendConfig(modalId) { function sendConfig(modalId) {
var modal = document.getElementById(modalId); var modal = document.getElementById(modalId);
var send = JSON.stringify(modifiedConfig); var send = JSON.stringify(modifiedConfig);
@ -649,8 +664,3 @@ document.getElementById('settingsSave').onclick = function() {
}; };
}; };

View File

@ -358,7 +358,7 @@ def modifyConfig():
@app.route("/getConfig", methods=["GET"]) @app.route("/getConfig", methods=["GET"])
@auth.login_required @auth.login_required
def getConfig(): def getConfig():
log.debug('Config requested') log.debug("Config requested")
with open(config_base_path, "r") as f: with open(config_base_path, "r") as f:
config_base = json.load(f) config_base = json.load(f)
config.read(config_path) config.read(config_path)