diff --git a/dashboard-ui/bower_components/emby-apiclient/apiclient.js b/dashboard-ui/bower_components/emby-apiclient/apiclient.js index ccfc1039e1..0eefbccb94 100644 --- a/dashboard-ui/bower_components/emby-apiclient/apiclient.js +++ b/dashboard-ui/bower_components/emby-apiclient/apiclient.js @@ -1728,7 +1728,7 @@ * Adds a virtual folder * @param {String} name */ - self.addVirtualFolder = function (name, type, refreshLibrary, initialPaths) { + self.addVirtualFolder = function (name, type, refreshLibrary, initialPaths, libraryOptions) { if (!name) { throw new Error("null name"); @@ -1751,7 +1751,8 @@ type: "POST", url: url, data: JSON.stringify({ - Paths: initialPaths + Paths: initialPaths, + LibraryOptions: libraryOptions }), contentType: 'application/json' }); diff --git a/dashboard-ui/components/libraryoptionseditor/libraryoptionseditor.js b/dashboard-ui/components/libraryoptionseditor/libraryoptionseditor.js new file mode 100644 index 0000000000..9bfb397b4d --- /dev/null +++ b/dashboard-ui/components/libraryoptionseditor/libraryoptionseditor.js @@ -0,0 +1,55 @@ +define(['globalize', 'emby-checkbox'], function (globalize) { + + function embed(parent, contentType) { + + return new Promise(function (resolve, reject) { + + var xhr = new XMLHttpRequest(); + xhr.open('GET', 'components/libraryoptionseditor/libraryoptionseditor.template.html', true); + + xhr.onload = function (e) { + + var template = this.response; + parent.innerHTML = globalize.translateDocument(template); + + setContentType(parent, contentType); + + resolve(); + } + + xhr.send(); + }); + } + + function setContentType(parent, contentType) { + + if (contentType == 'music' || contentType == 'tvshows' || contentType == 'movies' || contentType == 'homevideos' || contentType == 'musicvideos' || contentType == 'mixed') { + parent.querySelector('.chkArhiveAsMediaContainer').classList.remove('hide'); + } else { + parent.querySelector('.chkArhiveAsMediaContainer').classList.add('hide'); + } + + if (contentType == 'music' || contentType == 'tvshows' || contentType == 'movies' || contentType == 'homevideos' || contentType == 'musicvideos' || contentType == 'mixed') { + parent.classList.remove('hide'); + } else { + parent.classList.add('hide'); + } + } + + function getLibraryOptions(parent) { + + var options = { + EnableVideoArchiveFiles: parent.querySelector('.chkArhiveAsMedia').checked + }; + + options.EnableAudioArchiveFiles = options.EnableVideoArchiveFiles; + + return options; + } + + return { + embed: embed, + setContentType: setContentType, + getLibraryOptions: getLibraryOptions + }; +}); \ No newline at end of file diff --git a/dashboard-ui/components/libraryoptionseditor/libraryoptionseditor.template.html b/dashboard-ui/components/libraryoptionseditor/libraryoptionseditor.template.html new file mode 100644 index 0000000000..8ce697d914 --- /dev/null +++ b/dashboard-ui/components/libraryoptionseditor/libraryoptionseditor.template.html @@ -0,0 +1,8 @@ +

${HeaderSettings}

+
+ +
${OptionDetectArchiveFilesAsMediaHelp}
+
diff --git a/dashboard-ui/components/medialibrarycreator/medialibrarycreator.js b/dashboard-ui/components/medialibrarycreator/medialibrarycreator.js index 6e57bee07a..f7d1dbea0c 100644 --- a/dashboard-ui/components/medialibrarycreator/medialibrarycreator.js +++ b/dashboard-ui/components/medialibrarycreator/medialibrarycreator.js @@ -1,4 +1,4 @@ -define(['dialogHelper', 'jQuery', 'emby-input', 'emby-select', 'paper-icon-button-light', 'listViewStyle', 'formDialogStyle'], function (dialogHelper, $) { +define(['dialogHelper', 'jQuery', 'components/libraryoptionseditor/libraryoptionseditor', 'emby-input', 'emby-select', 'paper-icon-button-light', 'listViewStyle', 'formDialogStyle'], function (dialogHelper, $, libraryoptionseditor) { var currentDeferred; var hasChanges; @@ -27,7 +27,9 @@ type = null; } - ApiClient.addVirtualFolder(name, type, currentOptions.refresh, paths).then(function () { + var libraryOptions = libraryoptionseditor.getLibraryOptions(dlg.querySelector('.libraryOptions')); + + ApiClient.addVirtualFolder(name, type, currentOptions.refresh, paths, libraryOptions).then(function () { hasChanges = true; dialogHelper.close(dlg); @@ -59,12 +61,16 @@ $('#selectCollectionType', page).html(getCollectionTypeOptionsHtml(collectionTypeOptions)).val('').on('change', function () { - if (this.value == 'mixed') { - return; - } + var value = this.value; var dlg = $(this).parents('.dialog')[0]; + libraryoptionseditor.setContentType(dlg.querySelector('.libraryOptions'), value); + + if (value == 'mixed') { + return; + } + var index = this.selectedIndex; if (index != -1) { @@ -72,8 +78,6 @@ .replace('*', '') .replace('&', '&'); - var value = this.value; - $('#txtValue', dlg).val(name); var folderOption = collectionTypeOptions.filter(function (i) { @@ -178,6 +182,10 @@ currentDeferred.resolveWith(null, [hasChanges]); } + function initLibraryOptions(dlg) { + libraryoptionseditor.embed(dlg.querySelector('.libraryOptions')); + } + function editor() { var self = this; @@ -225,6 +233,7 @@ paths = []; renderPaths(dlg); + initLibraryOptions(dlg); } xhr.send(); diff --git a/dashboard-ui/components/medialibrarycreator/medialibrarycreator.template.html b/dashboard-ui/components/medialibrarycreator/medialibrarycreator.template.html index c0562c618f..dbb428ac47 100644 --- a/dashboard-ui/components/medialibrarycreator/medialibrarycreator.template.html +++ b/dashboard-ui/components/medialibrarycreator/medialibrarycreator.template.html @@ -14,10 +14,10 @@
- +
-
-

${HeadersFolders}

+
+

${HeadersFolders}

+
+