diff --git a/dashboard-ui/apiclient/apiclient.js b/dashboard-ui/apiclient/apiclient.js index e301143cb2..c465512ba7 100644 --- a/dashboard-ui/apiclient/apiclient.js +++ b/dashboard-ui/apiclient/apiclient.js @@ -1800,7 +1800,7 @@ * Adds a virtual folder * @param {String} name */ - self.addVirtualFolder = function (name, type, refreshLibrary) { + self.addVirtualFolder = function (name, type, refreshLibrary, initialPath) { if (!name) { throw new Error("null name"); @@ -1821,7 +1821,10 @@ return self.ajax({ type: "POST", - url: url + url: url, + data: { + Path: initialPath + } }); }; diff --git a/dashboard-ui/components/medialibraryeditor/medialibraryeditor.js b/dashboard-ui/components/medialibrarycreator/medialibrarycreator.js similarity index 65% rename from dashboard-ui/components/medialibraryeditor/medialibraryeditor.js rename to dashboard-ui/components/medialibrarycreator/medialibrarycreator.js index 6da4a152ff..5c36327994 100644 --- a/dashboard-ui/components/medialibraryeditor/medialibraryeditor.js +++ b/dashboard-ui/components/medialibrarycreator/medialibrarycreator.js @@ -9,7 +9,11 @@ var form = this; var dlg = $(form).parents('paper-dialog')[0]; - ApiClient.addVirtualFolder($('#txtValue', form).val(), $('#selectCollectionType', form).val(), currentOptions.refresh).done(function () { + var name = $('#txtValue', form).val(); + var type = $('#selectCollectionType', form).val(); + var path = $('#txtPath', form).val(); + + ApiClient.addVirtualFolder(name, type, currentOptions.refresh, path).done(function () { hasChanges = true; PaperDialogHelper.close(dlg); @@ -37,7 +41,49 @@ function initEditor(page, collectionTypeOptions) { - $('#selectCollectionType', page).html(getCollectionTypeOptionsHtml(collectionTypeOptions)).val(''); + $('#selectCollectionType', page).html(getCollectionTypeOptionsHtml(collectionTypeOptions)).val('').on('change', function () { + + var dlg = $(this).parents('paper-dialog')[0]; + + var index = this.selectedIndex; + if (index != -1) { + + var name = this.options[index].innerHTML + .replace('*', '') + .replace('&', '&'); + + var value = this.value; + + $('#txtValue', dlg).val(name); + + var folderOption = collectionTypeOptions.filter(function (i) { + + return i.value == value; + + })[0]; + + $('.collectionTypeFieldDescription', dlg).html(folderOption.message || ''); + } + }); + + $('#btnSelectPath').on('click', function () { + + require(['directorybrowser'], function (directoryBrowser) { + + var picker = new directoryBrowser(); + + picker.show({ + + callback: function (path) { + if (path) { + $('#txtPath', page).val(path); + } + picker.close(); + } + + }); + }); + }); $('form', page).off('submit', onSubmit).on('submit', onSubmit); } @@ -66,7 +112,7 @@ HttpClient.send({ type: 'GET', - url: 'components/medialibraryeditor/medialibraryeditor.template.html' + url: 'components/medialibrarycreator/medialibrarycreator.template.html' }).done(function (template) { @@ -96,7 +142,7 @@ $(dlg).on('iron-overlay-closed', onDialogClosed); - PaperDialogHelper.openWithHash(dlg, 'medialibraryeditor'); + PaperDialogHelper.openWithHash(dlg, 'medialibrarycreator'); $('.btnCloseDialog', dlg).on('click', function () { diff --git a/dashboard-ui/components/medialibraryeditor/medialibraryeditor.template.html b/dashboard-ui/components/medialibrarycreator/medialibrarycreator.template.html similarity index 67% rename from dashboard-ui/components/medialibraryeditor/medialibraryeditor.template.html rename to dashboard-ui/components/medialibrarycreator/medialibrarycreator.template.html index b7347dc14c..1640bd6854 100644 --- a/dashboard-ui/components/medialibraryeditor/medialibraryeditor.template.html +++ b/dashboard-ui/components/medialibrarycreator/medialibrarycreator.template.html @@ -6,9 +6,14 @@
+