jellyfin-web/dashboard-ui/dashboard/librarydisplay.js

65 lines
2.6 KiB
JavaScript
Raw Normal View History

2016-08-27 12:14:04 -07:00
define(['globalize', 'emby-checkbox', 'emby-button'], function (globalize) {
2016-06-03 22:51:33 -07:00
function getTabs() {
return [
{
href: 'library.html',
2016-09-24 10:58:17 -07:00
name: globalize.translate('HeaderLibraries')
2016-06-03 22:51:33 -07:00
},
{
href: 'librarydisplay.html',
name: globalize.translate('TabDisplay')
},
{
href: 'librarypathmapping.html',
name: globalize.translate('TabPathSubstitution')
},
{
href: 'librarysettings.html',
name: globalize.translate('TabAdvanced')
}];
}
return function (view, params) {
var self = this;
view.querySelector('form').addEventListener('submit', function (e) {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getServerConfiguration().then(function (config) {
config.EnableFolderView = form.querySelector('.chkFolderView').checked;
2016-06-08 10:10:07 -07:00
config.EnableGroupingIntoCollections = form.querySelector('.chkGroupMoviesIntoCollections').checked;
config.DisplaySpecialsWithinSeasons = form.querySelector('.chkDisplaySpecialsWithinSeasons').checked;
2016-06-13 12:02:48 -07:00
config.DisplayCollectionsView = form.querySelector('.chkDisplayCollectionView').checked;
2016-08-31 13:46:09 -07:00
config.EnableChannelView = !form.querySelector('.chkDisplayChannelsInline').checked;
config.EnableExternalContentInSuggestions = form.querySelector('.chkExternalContentInSuggestions').checked;
2016-06-06 14:12:44 -07:00
2016-06-03 22:51:33 -07:00
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
});
e.preventDefault();
return false;
});
function loadData() {
ApiClient.getServerConfiguration().then(function (config) {
view.querySelector('.chkFolderView').checked = config.EnableFolderView;
2016-06-05 12:44:55 -07:00
view.querySelector('.chkGroupMoviesIntoCollections').checked = config.EnableGroupingIntoCollections;
2016-06-06 14:12:44 -07:00
view.querySelector('.chkDisplaySpecialsWithinSeasons').checked = config.DisplaySpecialsWithinSeasons;
2016-06-13 12:02:48 -07:00
view.querySelector('.chkDisplayCollectionView').checked = config.DisplayCollectionsView;
2016-08-31 13:46:09 -07:00
view.querySelector('.chkDisplayChannelsInline').checked = !(config.EnableChannelView || false);
view.querySelector('.chkExternalContentInSuggestions').checked = config.EnableExternalContentInSuggestions;
2016-06-03 22:51:33 -07:00
});
}
view.addEventListener('viewshow', function () {
LibraryMenu.setTabs('librarysetup', 1, getTabs);
loadData();
});
};
});