mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
apply suggestions from code review
Co-Authored-By: dkanada <dkanada@users.noreply.github.com>
This commit is contained in:
parent
14005d6c63
commit
06d2154434
3 changed files with 49 additions and 17 deletions
|
@ -2,7 +2,11 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox", "emby-textarea", "emb
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function loadPage(page, config, languageOptions, systemInfo) {
|
function loadPage(page, config, languageOptions, systemInfo) {
|
||||||
systemInfo.CanLaunchWebBrowser ? page.querySelector("#fldRunWebAppAtStartup").classList.remove("hide") : page.querySelector("#fldRunWebAppAtStartup").classList.add("hide");
|
if (systemInfo.CanLaunchWebBrowser) {
|
||||||
|
page.querySelector("#fldRunWebAppAtStartup").classList.remove("hide");
|
||||||
|
} else {
|
||||||
|
page.querySelector("#fldRunWebAppAtStartup").classList.add("hide");
|
||||||
|
}
|
||||||
page.querySelector("#txtCachePath").value = config.CachePath || "";
|
page.querySelector("#txtCachePath").value = config.CachePath || "";
|
||||||
$("#txtMetadataPath", page).val(config.MetadataPath || "");
|
$("#txtMetadataPath", page).val(config.MetadataPath || "");
|
||||||
$("#txtMetadataNetworkPath", page).val(config.MetadataNetworkPath || "");
|
$("#txtMetadataNetworkPath", page).val(config.MetadataNetworkPath || "");
|
||||||
|
@ -10,11 +14,23 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox", "emby-textarea", "emb
|
||||||
return '<option value="' + l.Value + '">' + l.Name + "</option>"
|
return '<option value="' + l.Value + '">' + l.Name + "</option>"
|
||||||
})).val(config.UICulture);
|
})).val(config.UICulture);
|
||||||
currentLanguage = config.UICulture;
|
currentLanguage = config.UICulture;
|
||||||
systemInfo.CanSelfUpdate ? page.querySelector(".fldAutomaticUpdates").classList.remove("hide") : page.querySelector(".fldAutomaticUpdates").classList.add("hide");
|
if (systemInfo.CanSelfUpdate) {
|
||||||
|
page.querySelector(".fldAutomaticUpdates").classList.remove("hide");
|
||||||
|
} else {
|
||||||
|
page.querySelector(".fldAutomaticUpdates").classList.add("hide");
|
||||||
|
}
|
||||||
$("#chkEnableAutomaticServerUpdates", page).checked(config.EnableAutoUpdate);
|
$("#chkEnableAutomaticServerUpdates", page).checked(config.EnableAutoUpdate);
|
||||||
$("#chkEnableAutomaticRestart", page).checked(config.EnableAutomaticRestart);
|
$("#chkEnableAutomaticRestart", page).checked(config.EnableAutomaticRestart);
|
||||||
systemInfo.CanSelfRestart ? page.querySelector("#fldEnableAutomaticRestart").classList.remove("hide") : page.querySelector("#fldEnableAutomaticRestart").classList.add("hide");
|
if (systemInfo.CanSelfRestart) {
|
||||||
systemInfo.CanSelfRestart || systemInfo.CanSelfUpdate ? $(".autoUpdatesContainer", page).removeClass("hide") : $(".autoUpdatesContainer", page).addClass("hide");
|
page.querySelector("#fldEnableAutomaticRestart").classList.remove("hide");
|
||||||
|
} else {
|
||||||
|
page.querySelector("#fldEnableAutomaticRestart").classList.add("hide");
|
||||||
|
}
|
||||||
|
if (systemInfo.CanSelfRestart || systemInfo.CanSelfUpdate) {
|
||||||
|
$(".autoUpdatesContainer", page).removeClass("hide");
|
||||||
|
} else {
|
||||||
|
$(".autoUpdatesContainer", page).addClass("hide");
|
||||||
|
}
|
||||||
loading.hide();
|
loading.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +53,9 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox", "emby-textarea", "emb
|
||||||
ApiClient.getNamedConfiguration(brandingConfigKey).then(function(brandingConfig) {
|
ApiClient.getNamedConfiguration(brandingConfigKey).then(function(brandingConfig) {
|
||||||
brandingConfig.LoginDisclaimer = form.querySelector("#txtLoginDisclaimer").value;
|
brandingConfig.LoginDisclaimer = form.querySelector("#txtLoginDisclaimer").value;
|
||||||
brandingConfig.CustomCss = form.querySelector("#txtCustomCss").value;
|
brandingConfig.CustomCss = form.querySelector("#txtCustomCss").value;
|
||||||
currentBrandingOptions && brandingConfig.CustomCss !== currentBrandingOptions.CustomCss && (requiresReload = !0);
|
if (currentBrandingOptions && brandingConfig.CustomCss !== currentBrandingOptions.CustomCss) {
|
||||||
|
requiresReload = true;
|
||||||
|
}
|
||||||
ApiClient.updateNamedConfiguration(brandingConfigKey, brandingConfig).then(function() {
|
ApiClient.updateNamedConfiguration(brandingConfigKey, brandingConfig).then(function() {
|
||||||
Dashboard.processServerConfigurationUpdateResult();
|
Dashboard.processServerConfigurationUpdateResult();
|
||||||
if (requiresReload && !AppInfo.isNativeApp) {
|
if (requiresReload && !AppInfo.isNativeApp) {
|
||||||
|
@ -59,7 +77,9 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox", "emby-textarea", "emb
|
||||||
var picker = new directoryBrowser;
|
var picker = new directoryBrowser;
|
||||||
picker.show({
|
picker.show({
|
||||||
callback: function(path) {
|
callback: function(path) {
|
||||||
path && (view.querySelector("#txtCachePath").value = path);
|
if (path) {
|
||||||
|
view.querySelector("#txtCachePath").value = path;
|
||||||
|
}
|
||||||
picker.close();
|
picker.close();
|
||||||
},
|
},
|
||||||
validateWriteable: true,
|
validateWriteable: true,
|
||||||
|
@ -71,11 +91,13 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox", "emby-textarea", "emb
|
||||||
|
|
||||||
$("#btnSelectMetadataPath", view).on("click.selectDirectory", function() {
|
$("#btnSelectMetadataPath", view).on("click.selectDirectory", function() {
|
||||||
require(["directorybrowser"], function(directoryBrowser) {
|
require(["directorybrowser"], function(directoryBrowser) {
|
||||||
var picker = new directoryBrowser;
|
var picker = new directoryBrowser();
|
||||||
picker.show({
|
picker.show({
|
||||||
path: $("#txtMetadataPath", view).val(),
|
path: $("#txtMetadataPath", view).val(),
|
||||||
callback: function(path) {
|
callback: function(path) {
|
||||||
path && $("#txtMetadataPath", view).val(path);
|
if (path) {
|
||||||
|
$("#txtMetadataPath", view).val(path);
|
||||||
|
}
|
||||||
picker.close();
|
picker.close();
|
||||||
},
|
},
|
||||||
validateWriteable: true,
|
validateWriteable: true,
|
||||||
|
@ -87,11 +109,13 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox", "emby-textarea", "emb
|
||||||
|
|
||||||
$("#btnSelectMetadataNetworkPath", view).on("click.selectDirectory", function() {
|
$("#btnSelectMetadataNetworkPath", view).on("click.selectDirectory", function() {
|
||||||
require(["directorybrowser"], function(directoryBrowser) {
|
require(["directorybrowser"], function(directoryBrowser) {
|
||||||
var picker = new directoryBrowser;
|
var picker = new directoryBrowser();
|
||||||
picker.show({
|
picker.show({
|
||||||
path: $("#txtMetadataNetworkPath", view).val(),
|
path: $("#txtMetadataNetworkPath", view).val(),
|
||||||
callback: function(path) {
|
callback: function(path) {
|
||||||
path && $("#txtMetadataNetworkPath", view).val(path);
|
if (path) {
|
||||||
|
$("#txtMetadataNetworkPath", view).val(path);
|
||||||
|
}
|
||||||
picker.close();
|
picker.close();
|
||||||
},
|
},
|
||||||
validateWriteable: true,
|
validateWriteable: true,
|
||||||
|
@ -103,10 +127,10 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox", "emby-textarea", "emb
|
||||||
|
|
||||||
$(".dashboardGeneralForm", view).off("submit", onSubmit).on("submit", onSubmit);
|
$(".dashboardGeneralForm", view).off("submit", onSubmit).on("submit", onSubmit);
|
||||||
view.addEventListener("viewshow", function() {
|
view.addEventListener("viewshow", function() {
|
||||||
var promise1 = ApiClient.getServerConfiguration();
|
var promiseConfig = ApiClient.getServerConfiguration();
|
||||||
var promise2 = ApiClient.getJSON(ApiClient.getUrl("Localization/Options"));
|
var promiseLanguageOptions = ApiClient.getJSON(ApiClient.getUrl("Localization/Options"));
|
||||||
var promise3 = ApiClient.getSystemInfo();
|
var promiseSystemInfo = ApiClient.getSystemInfo();
|
||||||
Promise.all([promise1, promise2, promise3]).then(function(responses) {
|
Promise.all([promiseConfig, promiseLanguageOptions, promiseSystemInfo]).then(function(responses) {
|
||||||
loadPage(view, responses[0], responses[1], responses[2]);
|
loadPage(view, responses[0], responses[1], responses[2]);
|
||||||
});
|
});
|
||||||
ApiClient.getNamedConfiguration(brandingConfigKey).then(function(config) {
|
ApiClient.getNamedConfiguration(brandingConfigKey).then(function(config) {
|
||||||
|
|
|
@ -80,7 +80,11 @@ define(["jQuery", "loading", "libraryMenu", "fnchecked", "emby-checkbox", "emby-
|
||||||
loadFanartConfig(page, metadata)
|
loadFanartConfig(page, metadata)
|
||||||
});
|
});
|
||||||
ApiClient.getSystemInfo().then(function(info) {
|
ApiClient.getSystemInfo().then(function(info) {
|
||||||
"Windows" === info.OperatingSystem ? page.querySelector(".fldSaveMetadataHidden").classList.remove("hide") : page.querySelector(".fldSaveMetadataHidden").classList.add("hide")
|
if ("Windows" === info.OperatingSystem) {
|
||||||
|
page.querySelector(".fldSaveMetadataHidden").classList.remove("hide");
|
||||||
|
} else {
|
||||||
|
page.querySelector(".fldSaveMetadataHidden").classList.add("hide");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,11 @@ define(["loading", "libraryMenu", "globalize", "listViewStyle", "emby-linkbutton
|
||||||
itemHtml += '<div class="paperList">';
|
itemHtml += '<div class="paperList">';
|
||||||
}
|
}
|
||||||
itemHtml += '<a class="listItem listItem-border" is="emby-linkbutton" data-ripple="false" href="notificationsetting.html?type=' + i.Type + '">';
|
itemHtml += '<a class="listItem listItem-border" is="emby-linkbutton" data-ripple="false" href="notificationsetting.html?type=' + i.Type + '">';
|
||||||
i.Enabled ? itemHtml += '<i class="listItemIcon md-icon">notifications_active</i>' : itemHtml += '<i class="listItemIcon md-icon" style="background-color:#999;">notifications_off</i>';
|
if (i.Enabled) {
|
||||||
|
itemHtml += '<i class="listItemIcon md-icon">notifications_active</i>';
|
||||||
|
} else {
|
||||||
|
itemHtml += '<i class="listItemIcon md-icon" style="background-color:#999;">notifications_off</i>';
|
||||||
|
}
|
||||||
itemHtml += '<div class="listItemBody">';
|
itemHtml += '<div class="listItemBody">';
|
||||||
itemHtml += '<div class="listItemBodyText">' + i.Name + "</div>";
|
itemHtml += '<div class="listItemBodyText">' + i.Name + "</div>";
|
||||||
itemHtml += "</div>";
|
itemHtml += "</div>";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue