mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
added library settings page
This commit is contained in:
parent
fac650a344
commit
e9ef2accdf
6 changed files with 165 additions and 80 deletions
100
dashboard-ui/scripts/librarysettings.js
Normal file
100
dashboard-ui/scripts/librarysettings.js
Normal file
|
@ -0,0 +1,100 @@
|
|||
(function ($, document, window) {
|
||||
|
||||
function loadPage(page, config) {
|
||||
|
||||
$('#txtItemsByNamePath', page).val(config.ItemsByNamePath);
|
||||
|
||||
var customIbn = config.ItemsByNamePath ? true : false;
|
||||
$('#chkEnableCustomIBNPath', page).checked(customIbn).checkboxradio("refresh");
|
||||
|
||||
if (customIbn) {
|
||||
$('#fieldEnterIBNPath', page).show();
|
||||
$('#txtItemsByNamePath', page).attr("required", "required");
|
||||
} else {
|
||||
$('#fieldEnterIBNPath', page).hide();
|
||||
$('#txtItemsByNamePath', page).removeAttr("required");
|
||||
}
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
$(document).on('pageshow', "#librarySettingsPage", function () {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var page = this;
|
||||
|
||||
$('#btnSelectIBNPath', page).on("click.selectDirectory", function () {
|
||||
|
||||
Dashboard.selectDirectory({
|
||||
|
||||
callback: function (path) {
|
||||
|
||||
if (path) {
|
||||
$('#txtItemsByNamePath', page).val(path);
|
||||
}
|
||||
$('#popupDirectoryPicker', page).popup("close");
|
||||
},
|
||||
|
||||
header: "Select Items By Name Path",
|
||||
|
||||
instruction: "Browse or enter the path to your items by name folder. The folder must be writeable."
|
||||
});
|
||||
});
|
||||
|
||||
$('#chkEnableCustomIBNPath', page).on("change.showIBNText", function () {
|
||||
|
||||
if (this.checked) {
|
||||
$('#fieldEnterIBNPath', page).show();
|
||||
$('#txtItemsByNamePath', page).attr("required", "required");
|
||||
} else {
|
||||
$('#fieldEnterIBNPath', page).hide();
|
||||
$('#txtItemsByNamePath', page).removeAttr("required");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
|
||||
loadPage(page, config);
|
||||
|
||||
});
|
||||
|
||||
}).on('pagehide', "#librarySettingsPage", function () {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var page = this;
|
||||
|
||||
$('#chkEnableCustomIBNPath', page).off("change.showIBNText");
|
||||
$('#btnSelectIBNPath', page).off("click.selectDirectory");
|
||||
});
|
||||
|
||||
function librarySettingsPage() {
|
||||
|
||||
var self = this;
|
||||
|
||||
self.onSubmit = function () {
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
|
||||
if ($('#chkEnableCustomIBNPath', form).checked()) {
|
||||
config.ItemsByNamePath = $('#txtItemsByNamePath', form).val();
|
||||
} else {
|
||||
config.ItemsByNamePath = '';
|
||||
}
|
||||
|
||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
window.LibrarySettingsPage = new librarySettingsPage();
|
||||
|
||||
})(jQuery, document, window);
|
Loading…
Add table
Add a link
Reference in a new issue