diff --git a/dashboard-ui/bower_components/emby-webcomponents/dialoghelper/dialoghelper.js b/dashboard-ui/bower_components/emby-webcomponents/dialoghelper/dialoghelper.js index 57a68356ee..2078a93430 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/dialoghelper/dialoghelper.js +++ b/dashboard-ui/bower_components/emby-webcomponents/dialoghelper/dialoghelper.js @@ -283,6 +283,11 @@ if (!dlg.classList.contains('hide')) { + dlg.dispatchEvent(new CustomEvent('closing', { + bubbles: false, + cancelable: false + })); + var onAnimationFinish = function () { focusManager.popScope(dlg); diff --git a/dashboard-ui/components/libraryoptionseditor/libraryoptionseditor.js b/dashboard-ui/components/libraryoptionseditor/libraryoptionseditor.js index 9bfb397b4d..0d6631497b 100644 --- a/dashboard-ui/components/libraryoptionseditor/libraryoptionseditor.js +++ b/dashboard-ui/components/libraryoptionseditor/libraryoptionseditor.js @@ -1,6 +1,6 @@ define(['globalize', 'emby-checkbox'], function (globalize) { - function embed(parent, contentType) { + function embed(parent, contentType, libraryOptions) { return new Promise(function (resolve, reject) { @@ -14,6 +14,10 @@ setContentType(parent, contentType); + if (libraryOptions) { + setLibraryOptions(parent, libraryOptions); + } + resolve(); } @@ -39,17 +43,23 @@ function getLibraryOptions(parent) { var options = { - EnableVideoArchiveFiles: parent.querySelector('.chkArhiveAsMedia').checked + EnableArchiveMediaFiles: parent.querySelector('.chkArhiveAsMedia').checked }; - options.EnableAudioArchiveFiles = options.EnableVideoArchiveFiles; + options.EnableAudioArchiveFiles = options.EnableArchiveMediaFiles; return options; } + function setLibraryOptions(parent, options) { + + parent.querySelector('.chkArhiveAsMedia').checked = options.EnableArchiveMediaFiles;; + } + return { embed: embed, setContentType: setContentType, - getLibraryOptions: getLibraryOptions + getLibraryOptions: getLibraryOptions, + setLibraryOptions: setLibraryOptions }; }); \ No newline at end of file diff --git a/dashboard-ui/components/medialibraryeditor/medialibraryeditor.js b/dashboard-ui/components/medialibraryeditor/medialibraryeditor.js index a23e593fb3..0d972f3c0d 100644 --- a/dashboard-ui/components/medialibraryeditor/medialibraryeditor.js +++ b/dashboard-ui/components/medialibraryeditor/medialibraryeditor.js @@ -1,4 +1,4 @@ -define(['dialogHelper', 'jQuery', 'emby-button', 'listViewStyle', 'paper-icon-button-light'], function (dialogHelper, $) { +define(['dialogHelper', 'dom', 'components/libraryoptionseditor/libraryoptionseditor', 'emby-button', 'listViewStyle', 'paper-icon-button-light', 'formDialogStyle'], function (dialogHelper, dom, libraryoptionseditor) { var currentDeferred; var hasChanges; @@ -41,7 +41,7 @@ ApiClient.removeMediaPath(virtualFolder.Name, location, refreshAfterChange).then(function () { hasChanges = true; - refreshLibraryFromServer($(button).parents('.editorContent')[0]); + refreshLibraryFromServer(dom.parentWithClass(button, 'dlg-libraryeditor')); }, function () { @@ -96,12 +96,15 @@ page.querySelector('.folderList').innerHTML = foldersHtml; - $(page.querySelectorAll('.btnRemovePath')).on('click', onRemoveClick); + var btnRemovePath = page.querySelectorAll('.btnRemovePath'); + for (var i = 0, length = btnRemovePath.length; i < length; i++) { + btnRemovePath[i].addEventListener('click', onRemoveClick); + } } function onAddButtonClick() { - var page = $(this).parents('.editorContent')[0]; + var page = dom.parentWithClass(this, 'dlg-libraryeditor'); require(['directorybrowser'], function (directoryBrowser) { @@ -121,15 +124,20 @@ }); } - function initEditor(page, options) { - renderLibrary(page, options); + function initEditor(dlg, options) { + renderLibrary(dlg, options); + + dlg.querySelector('.btnAddFolder').addEventListener('click', onAddButtonClick); + + libraryoptionseditor.embed(dlg.querySelector('.libraryOptions'), options.library.CollectionType, options.library.LibraryOptions); + } + + function onDialogClosing() { - $('.btnAddFolder', page).on('click', onAddButtonClick); } function onDialogClosed() { - $(this).remove(); Dashboard.hideLoadingMsg(); currentDeferred.resolveWith(null, [hasChanges]); } @@ -156,39 +164,33 @@ size: 'small', // In (at least) chrome this is causing the text field to not be editable - modal: false + modal: false, + removeOnClose: true }); + dlg.classList.add('dlg-libraryeditor'); dlg.classList.add('ui-body-a'); dlg.classList.add('background-theme-a'); - var html = ''; - html += '