From 44ba7a5cc4a42cb3f6877c65b223707837641d90 Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 5 Mar 2019 21:12:13 +0900 Subject: [PATCH] deminification and move metadata path setting --- src/dashboard/dashboardgeneral.js | 45 ++++++++++++++++++++++++++----- src/dashboard/librarysettings.js | 17 +----------- src/dashboardgeneral.html | 13 ++++++++- src/librarysettings.html | 10 ------- 4 files changed, 51 insertions(+), 34 deletions(-) diff --git a/src/dashboard/dashboardgeneral.js b/src/dashboard/dashboardgeneral.js index f220be4cc0..74a7f1cc8f 100644 --- a/src/dashboard/dashboardgeneral.js +++ b/src/dashboard/dashboardgeneral.js @@ -12,13 +12,25 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox", "emby-textarea", "emb var form = this; $(form).parents(".page"); return ApiClient.getServerConfiguration().then(function(config) { - config.UICulture = $("#selectLocalizationLanguage", form).val(), config.CachePath = form.querySelector("#txtCachePath").value; - var requiresReload = !1; - config.UICulture !== currentLanguage && (requiresReload = !0), config.EnableAutomaticRestart = $("#chkEnableAutomaticRestart", form).checked(), config.EnableAutoUpdate = $("#chkEnableAutomaticServerUpdates", form).checked(), ApiClient.updateServerConfiguration(config).then(function() { + config.UICulture = $("#selectLocalizationLanguage", form).val(); + config.CachePath = form.querySelector("#txtCachePath").value; + var requiresReload = false; + if (config.UICulture !== currentLanguage) { + requiresReload = true; + } + config.EnableAutomaticRestart = $("#chkEnableAutomaticRestart", form).checked(); + config.EnableAutoUpdate = $("#chkEnableAutomaticServerUpdates", form).checked(); + ApiClient.updateServerConfiguration(config).then(function() { ApiClient.getNamedConfiguration(brandingConfigKey).then(function(brandingConfig) { - brandingConfig.LoginDisclaimer = form.querySelector("#txtLoginDisclaimer").value, brandingConfig.CustomCss = form.querySelector("#txtCustomCss").value, currentBrandingOptions && brandingConfig.CustomCss !== currentBrandingOptions.CustomCss && (requiresReload = !0), ApiClient.updateNamedConfiguration(brandingConfigKey, brandingConfig).then(function() { - Dashboard.processServerConfigurationUpdateResult(), requiresReload && !AppInfo.isNativeApp && window.location.reload(!0) - }) + brandingConfig.LoginDisclaimer = form.querySelector("#txtLoginDisclaimer").value; + brandingConfig.CustomCss = form.querySelector("#txtCustomCss").value; + currentBrandingOptions && brandingConfig.CustomCss !== currentBrandingOptions.CustomCss && (requiresReload = !0); + ApiClient.updateNamedConfiguration(brandingConfigKey, brandingConfig).then(function() { + Dashboard.processServerConfigurationUpdateResult(); + if (requiresReload && !AppInfo.isNativeApp) { + window.location.reload(true); + } + }); }) }) }), !1 @@ -37,7 +49,26 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox", "emby-textarea", "emb instruction: Globalize.translate("HeaderSelectServerCachePathHelp") }) }) - }), $(".dashboardGeneralForm", view).off("submit", onSubmit).on("submit", onSubmit), view.addEventListener("viewshow", function() { + }); + + $("#btnSelectMetadataPath", view).on("click.selectDirectory", function() { + require(["directorybrowser"], function(directoryBrowser) { + var picker = new directoryBrowser; + picker.show({ + path: $("#txtMetadataPath", view).val(), + networkSharePath: $("#txtMetadataNetworkPath", view).val(), + callback: function(path, networkPath) { + path && ($("#txtMetadataPath", view).val(path), $("#txtMetadataNetworkPath", view).val(networkPath)), picker.close() + }, + validateWriteable: !0, + header: Globalize.translate("HeaderSelectMetadataPath"), + instruction: Globalize.translate("HeaderSelectMetadataPathHelp"), + enableNetworkSharePath: !0 + }) + }) + }); + + $(".dashboardGeneralForm", view).off("submit", onSubmit).on("submit", onSubmit), view.addEventListener("viewshow", function() { var promise1 = ApiClient.getServerConfiguration(), promise2 = ApiClient.getJSON(ApiClient.getUrl("Localization/Options")), promise3 = ApiClient.getSystemInfo(); diff --git a/src/dashboard/librarysettings.js b/src/dashboard/librarysettings.js index afbf033dfb..4a967537b7 100644 --- a/src/dashboard/librarysettings.js +++ b/src/dashboard/librarysettings.js @@ -62,22 +62,7 @@ define(["jQuery", "loading", "libraryMenu", "fnchecked", "emby-checkbox", "emby- }] } return function(view, params) { - $("#btnSelectMetadataPath", view).on("click.selectDirectory", function() { - require(["directorybrowser"], function(directoryBrowser) { - var picker = new directoryBrowser; - picker.show({ - path: $("#txtMetadataPath", view).val(), - networkSharePath: $("#txtMetadataNetworkPath", view).val(), - callback: function(path, networkPath) { - path && ($("#txtMetadataPath", view).val(path), $("#txtMetadataNetworkPath", view).val(networkPath)), picker.close() - }, - validateWriteable: !0, - header: Globalize.translate("HeaderSelectMetadataPath"), - instruction: Globalize.translate("HeaderSelectMetadataPathHelp"), - enableNetworkSharePath: !0 - }) - }) - }), $(".librarySettingsForm").off("submit", onSubmit).on("submit", onSubmit), view.addEventListener("viewshow", function() { + $(".librarySettingsForm").off("submit", onSubmit).on("submit", onSubmit), view.addEventListener("viewshow", function() { libraryMenu.setTabs("librarysetup", 4, getTabs), loading.show(); var page = this; ApiClient.getServerConfiguration().then(function(config) { diff --git a/src/dashboardgeneral.html b/src/dashboardgeneral.html index 16d170e62b..a31db79d66 100644 --- a/src/dashboardgeneral.html +++ b/src/dashboardgeneral.html @@ -34,7 +34,7 @@
-

${Advanced}

+

${HeaderPaths}

@@ -44,6 +44,16 @@
${LabelCachePathHelp}
+
+
+
+ +
+ +
+
${LabelMetadataPathHelp}
+ +
@@ -62,6 +72,7 @@
+

${TabOther}

${LabelLoginDisclaimerHelp}
diff --git a/src/librarysettings.html b/src/librarysettings.html index 7b75ff7e19..f99ebfb4e0 100644 --- a/src/librarysettings.html +++ b/src/librarysettings.html @@ -11,16 +11,6 @@
${LabelDateAddedBehaviorHelp}
-
-
-
- -
- -
-
${LabelMetadataPathHelp}
- -