diff --git a/dashboard-ui/components/viewcontainer-lite.js b/dashboard-ui/components/viewcontainer-lite.js index 8b8bbcd1ce..846aa924e3 100644 --- a/dashboard-ui/components/viewcontainer-lite.js +++ b/dashboard-ui/components/viewcontainer-lite.js @@ -75,6 +75,8 @@ define(['browser'], function (browser) { view.innerHTML = newView; } + view.classList.add('mainAnimatedPage'); + if (currentPage) { if (newViewInfo.hasScript && window.$) { // TODO: figure this out without jQuery @@ -101,7 +103,6 @@ define(['browser'], function (browser) { } var animatable = view; - view.classList.add('mainAnimatedPage'); allPages[pageIndex] = view; if (onBeforeChange) { @@ -145,7 +146,7 @@ define(['browser'], function (browser) { } } - if (hasJqm) { + if (hasJqm && window.$) { $(newView).trigger('create'); } } @@ -174,9 +175,14 @@ define(['browser'], function (browser) { } var hasScript = options.view.indexOf(' + +
+
+
+
+ ${OptionDisplayFolderView} +
${OptionDisplayFolderViewHelp}
+
+
+
+ + +
+
+
+ \ No newline at end of file diff --git a/dashboard-ui/scripts/librarydisplay.js b/dashboard-ui/scripts/librarydisplay.js new file mode 100644 index 0000000000..b568fcb136 --- /dev/null +++ b/dashboard-ui/scripts/librarydisplay.js @@ -0,0 +1,54 @@ +define(['globalize'], function (globalize) { + + function getTabs() { + return [ + { + href: 'library.html', + name: globalize.translate('TabFolders') + }, + { + 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; + ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult); + }); + + e.preventDefault(); + return false; + }); + + function loadData() { + ApiClient.getServerConfiguration().then(function (config) { + view.querySelector('.chkFolderView').checked = config.EnableFolderView; + }); + } + + view.addEventListener('viewshow', function () { + LibraryMenu.setTabs('librarysetup', 1, getTabs); + loadData(); + }); + }; +}); \ No newline at end of file diff --git a/dashboard-ui/scripts/librarypathmapping.js b/dashboard-ui/scripts/librarypathmapping.js index 99b4f827d2..dda458c72b 100644 --- a/dashboard-ui/scripts/librarypathmapping.js +++ b/dashboard-ui/scripts/librarypathmapping.js @@ -118,6 +118,10 @@ href: 'library.html', name: Globalize.translate('TabFolders') }, + { + href: 'librarydisplay.html', + name: Globalize.translate('TabDisplay') + }, { href: 'librarypathmapping.html', name: Globalize.translate('TabPathSubstitution') @@ -139,7 +143,7 @@ }).on('pageshow', "#libraryPathMappingPage", function () { - LibraryMenu.setTabs('librarysetup', 1, getTabs); + LibraryMenu.setTabs('librarysetup', 2, getTabs); Dashboard.showLoadingMsg(); var page = this; diff --git a/dashboard-ui/scripts/librarysettings.js b/dashboard-ui/scripts/librarysettings.js index 711b7e78b0..ff78e8db92 100644 --- a/dashboard-ui/scripts/librarysettings.js +++ b/dashboard-ui/scripts/librarysettings.js @@ -132,6 +132,10 @@ href: 'library.html', name: Globalize.translate('TabFolders') }, + { + href: 'librarydisplay.html', + name: Globalize.translate('TabDisplay') + }, { href: 'librarypathmapping.html', name: Globalize.translate('TabPathSubstitution') @@ -144,7 +148,7 @@ $(document).on('pageshow', "#librarySettingsPage", function () { - LibraryMenu.setTabs('librarysetup', 2, getTabs); + LibraryMenu.setTabs('librarysetup', 3, getTabs); Dashboard.showLoadingMsg(); var page = this; diff --git a/dashboard-ui/scripts/medialibrarypage.js b/dashboard-ui/scripts/medialibrarypage.js index 928c0924d4..ee1a15ed36 100644 --- a/dashboard-ui/scripts/medialibrarypage.js +++ b/dashboard-ui/scripts/medialibrarypage.js @@ -459,6 +459,10 @@ href: 'library.html', name: Globalize.translate('TabFolders') }, + { + href: 'librarydisplay.html', + name: Globalize.translate('TabDisplay') + }, { href: 'librarypathmapping.html', name: Globalize.translate('TabPathSubstitution') diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 0f082486b7..a170959324 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -1958,7 +1958,7 @@ var AppInfo = {}; define("montserratFont", ['css!' + embyWebComponentsBowerPath + '/fonts/montserrat/style']); define("scrollStyles", ['css!' + embyWebComponentsBowerPath + '/scrollstyles']); - define("viewcontainer", ['components/viewcontainer-lite'], returnFirstDependency); + define("viewcontainer", ['components/viewcontainer-lite', embyWebComponentsBowerPath + '/viewmanager/viewcontainer-lite'], returnFirstDependency); define('queryString', [bowerPath + '/query-string/index'], function () { return queryString; }); @@ -2574,6 +2574,14 @@ var AppInfo = {}; roles: 'admin' }); + defineRoute({ + path: '/librarydisplay.html', + dependencies: ['paper-button', 'paper-checkbox'], + autoFocus: false, + roles: 'admin', + controller: 'scripts/librarydisplay' + }); + defineRoute({ path: '/librarypathmapping.html', dependencies: [], diff --git a/dashboard-ui/strings/en-US.json b/dashboard-ui/strings/en-US.json index e208aed07a..8273317ca5 100644 --- a/dashboard-ui/strings/en-US.json +++ b/dashboard-ui/strings/en-US.json @@ -1136,7 +1136,8 @@ "OptionOthers": "Others", "HeaderDownloadPeopleMetadataForHelp": "Enabling additional options will provide more on-screen information but will result in slower library scans.", "ViewTypeFolders": "Folders", - "LabelDisplayFoldersView": "Display a folders view to show plain media folders", + "OptionDisplayFolderView": "Display a folder view to show plain media folders", + "OptionDisplayFolderViewHelp": "If enabled, Emby apps wil display a Folders category alongside your media library. This is useful if you'd like to have plain folder views.", "ViewTypeLiveTvRecordingGroups": "Recordings", "ViewTypeLiveTvChannels": "Channels", "LabelEasyPinCode": "Easy pin code:",