From 8e94f04d5a098cb0c96e06711d2d21c84fe91893 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Tue, 30 Jun 2020 18:57:04 +0100 Subject: [PATCH] Add tooltips; cleanup --- jellyfin_accounts/data/static/admin.js | 22 ++++++++++++++++------ jellyfin_accounts/web_api.py | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/jellyfin_accounts/data/static/admin.js b/jellyfin_accounts/data/static/admin.js index 79f7433..44dd2cf 100644 --- a/jellyfin_accounts/data/static/admin.js +++ b/jellyfin_accounts/data/static/admin.js @@ -291,7 +291,8 @@ document.getElementById('openDefaultsWizard').onclick = function () { } else if (submitButton.classList.contains('btn-danger')) { submitButton.classList.remove('btn-danger'); submitButton.classList.add('btn-primary'); - } + }; + $('#settingsMenu').modal('hide'); $('#userDefaults').modal('show'); } } @@ -440,6 +441,7 @@ document.getElementById('openUsers').onclick = function () { var button = document.getElementById('openUsers'); button.disabled = false; button.innerHTML = 'Users '; + $('#settingsMenu').modal('hide'); $('#users').modal('show'); }; } @@ -496,6 +498,13 @@ document.getElementById('openSettings').onclick = function () { entryName += ' *'; required = true; }; + if (config[section][entry].hasOwnProperty('description')) { + var tooltip = ` + + `; + entryName += ' '; + entryName += tooltip; + }; // if (config[section][entry]['requires_restart']) { // entryName += ' R'; // }; @@ -575,6 +584,12 @@ document.getElementById('openSettings').onclick = function () { $('#settingsMenu').modal('show'); }; +$('#settingsMenu').on('shown.bs.modal', function() { + $("a[data-toggle='tooltip']").each(function (i, obj) { + $(obj).tooltip(); + }); +}); + function sendConfig(modalId) { var modal = document.getElementById(modalId); var send = JSON.stringify(modifiedConfig); @@ -649,8 +664,3 @@ document.getElementById('settingsSave').onclick = function() { }; }; - - - - - diff --git a/jellyfin_accounts/web_api.py b/jellyfin_accounts/web_api.py index cc83060..5d4c687 100644 --- a/jellyfin_accounts/web_api.py +++ b/jellyfin_accounts/web_api.py @@ -358,7 +358,7 @@ def modifyConfig(): @app.route("/getConfig", methods=["GET"]) @auth.login_required def getConfig(): - log.debug('Config requested') + log.debug("Config requested") with open(config_base_path, "r") as f: config_base = json.load(f) config.read(config_path)