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 @@
-

+

-

+
+
+ + +
${LabelAdditionalFoldersCanBeAddedHelp}
+

-
-
-
- ${ButtonScanLibrary} -
- -
${LabelLastResult}
-
+
+ + ${ButtonScanLibrary} +
+
diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 4b4b78904e..2c6cac104b 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -1964,7 +1964,7 @@ cssClass += ' groupedCard'; } - if (showTitle && !options.overlayText) { + if ((showTitle || options.showItemCounts) && !options.overlayText) { cssClass += ' bottomPaddedCard'; } diff --git a/dashboard-ui/scripts/medialibrarypage.js b/dashboard-ui/scripts/medialibrarypage.js index 47036e197a..683f630da7 100644 --- a/dashboard-ui/scripts/medialibrarypage.js +++ b/dashboard-ui/scripts/medialibrarypage.js @@ -76,9 +76,9 @@ function addVirtualFolder(page) { - require(['medialibraryeditor'], function (medialibraryeditor) { + require(['medialibrarycreator'], function (medialibrarycreator) { - new medialibraryeditor().show({ + new medialibrarycreator().show({ collectionTypeOptions: getCollectionTypeOptions(), refresh: shouldRefreshLibraryAfterChanges() @@ -212,9 +212,7 @@ showType: false, showLocations: false, showMenu: false, - showNameWithIcon: true, - color: 'green', - contentClass: 'addLibrary' + showNameWithIcon: true }); for (var i = 0, length = virtualFolders.length; i < length; i++) { @@ -299,12 +297,7 @@ html += '
'; - var contentClass = "cardContent"; - if (virtualFolder.contentClass) { - contentClass += " " + virtualFolder.contentClass; - } - - html += '
'; + html += '
'; var imgUrl = ''; if (virtualFolder.PrimaryImageItemId) { @@ -315,21 +308,10 @@ if (imgUrl) { html += '
'; - } else { + } else if (!virtualFolder.showNameWithIcon) { html += '
'; - - if (virtualFolder.color) { - html += '
'; - } else { - html += '
'; - } + html += '
'; html += ''; - - if (virtualFolder.showNameWithIcon) { - html += '
'; - html += virtualFolder.Name; - html += "
"; - } html += "
"; html += '
'; @@ -341,6 +323,22 @@ // cardScalable html += "
"; + if (!imgUrl && virtualFolder.showNameWithIcon) { + html += '
'; + + html += '
'; + html += ''; + + if (virtualFolder.showNameWithIcon) { + html += '
'; + html += virtualFolder.Name; + html += "
"; + } + html += "
"; + + html += '
'; + } + html += '
'; if (virtualFolder.showMenu !== false) { @@ -471,7 +469,6 @@ var WizardLibraryPage = { $('.btnRefresh', page).taskButton({ mode: 'on', progressElem: page.querySelector('.refreshProgress'), - lastResultElem: $('.lastRefreshResult', page), taskKey: 'RefreshLibrary' }); diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index bfa08d15b2..1c1e48fd25 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -2062,7 +2062,7 @@ var AppInfo = {}; directorybrowser: 'components/directorybrowser/directorybrowser', collectioneditor: 'components/collectioneditor/collectioneditor', playlisteditor: 'components/playlisteditor/playlisteditor', - medialibraryeditor: 'components/medialibraryeditor/medialibraryeditor', + medialibrarycreator: 'components/medialibrarycreator/medialibrarycreator', howler: 'bower_components/howler.js/howler.min', dragula: 'bower_components/dragula.js/dist/dragula.min' }; diff --git a/dashboard-ui/strings/html/en-US.json b/dashboard-ui/strings/html/en-US.json index 7248a435ee..8a2cd4c820 100644 --- a/dashboard-ui/strings/html/en-US.json +++ b/dashboard-ui/strings/html/en-US.json @@ -1521,5 +1521,7 @@ "HeaderCameraUpload": "Camera Upload", "SelectCameraUploadServers": "Upload camera photos to the following servers:", "ButtonClear": "Clear", - "ButtonEditImages": "Edit Images" + "ButtonEditImages": "Edit Images", + "LabelFolder": "Folder:", + "LabelAdditionalFoldersCanBeAddedHelp": "Additional folders can be added to this library after setting it up." } \ No newline at end of file diff --git a/dashboard-ui/strings/html/server.json b/dashboard-ui/strings/html/server.json index a38bce565b..da9050418c 100644 --- a/dashboard-ui/strings/html/server.json +++ b/dashboard-ui/strings/html/server.json @@ -1537,5 +1537,7 @@ "HeaderCameraUpload": "Camera Upload", "SelectCameraUploadServers": "Upload camera photos to the following servers:", "ButtonClear": "Clear", - "ButtonEditImages": "Edit Images" + "ButtonEditImages": "Edit Images", + "LabelFolder": "Folder:", + "LabelAdditionalFoldersCanBeAddedHelp": "Additional folders can be added to this library after setting it up." } diff --git a/dashboard-ui/thirdparty/paper-button-style.css b/dashboard-ui/thirdparty/paper-button-style.css index ef7ebf9dbc..67ca229997 100644 --- a/dashboard-ui/thirdparty/paper-button-style.css +++ b/dashboard-ui/thirdparty/paper-button-style.css @@ -557,6 +557,10 @@ paper-dialog.popupEditor .dialogHeader { margin-top: .7em; } +paper-dialog.popupEditor { + padding-bottom: 100px; +} + .paperToggleContainer { padding: .5em 0; }