diff --git a/src/components/confirm/confirm.js b/src/components/confirm/confirm.js index 730ca3cd7..f104350c8 100644 --- a/src/components/confirm/confirm.js +++ b/src/components/confirm/confirm.js @@ -18,13 +18,13 @@ define(['dialog', 'globalize'], function (dialog, globalize) { items.push({ name: options.cancelText || globalize.translate('ButtonCancel'), id: 'cancel', - type: options.primary === 'cancel' ? 'submit' : 'cancel' + type: 'cancel' }); items.push({ name: options.confirmText || globalize.translate('ButtonOk'), id: 'ok', - type: options.primary === 'cancel' ? 'cancel' : 'submit' + type: options.primary === 'delete' ? 'delete' : 'submit' }); options.buttons = items; @@ -37,4 +37,4 @@ define(['dialog', 'globalize'], function (dialog, globalize) { return Promise.reject(); }); }; -}); \ No newline at end of file +}); diff --git a/src/components/deletehelper.js b/src/components/deletehelper.js index ae0fdbdf5..2212fd443 100644 --- a/src/components/deletehelper.js +++ b/src/components/deletehelper.js @@ -27,7 +27,7 @@ define(['connectionManager', 'confirm', 'appRouter', 'globalize'], function (con title: title, text: msg, confirmText: globalize.translate('Delete'), - primary: 'cancel' + primary: 'delete' }).then(function () { @@ -54,4 +54,4 @@ define(['connectionManager', 'confirm', 'appRouter', 'globalize'], function (con return { deleteItem: deleteItem }; -}); \ No newline at end of file +}); diff --git a/src/components/imageeditor/imageeditor.js b/src/components/imageeditor/imageeditor.js index a0dfcd849..15c58ad8d 100644 --- a/src/components/imageeditor/imageeditor.js +++ b/src/components/imageeditor/imageeditor.js @@ -203,7 +203,7 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager', text: globalize.translate('ConfirmDeleteImage'), confirmText: globalize.translate('Delete'), - primary: 'cancel' + primary: 'delete' }).then(afterConfirm); }); @@ -471,7 +471,7 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager', initEditor(dlg, options); - // Has to be assigned a z-index after the call to .open() + // Has to be assigned a z-index after the call to .open() dlg.addEventListener('close', function () { if (layoutManager.tv) { @@ -510,4 +510,4 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager', }); } }; -}); \ No newline at end of file +}); diff --git a/src/components/medialibraryeditor/medialibraryeditor.js b/src/components/medialibraryeditor/medialibraryeditor.js index ef3a3d5b1..77a5f8f45 100644 --- a/src/components/medialibraryeditor/medialibraryeditor.js +++ b/src/components/medialibraryeditor/medialibraryeditor.js @@ -59,7 +59,7 @@ define(["loading", "dialogHelper", "dom", "components/libraryoptionseditor/libra title: Globalize.translate("HeaderRemoveMediaLocation"), text: Globalize.translate("MessageConfirmRemoveMediaLocation"), confirmText: Globalize.translate("ButtonDelete"), - primary: "cancel" + primary: "delete" }).then(function() { var refreshAfterChange = currentOptions.refresh; ApiClient.removeMediaPath(virtualFolder.Name, location, refreshAfterChange).then(function() { @@ -212,4 +212,4 @@ define(["loading", "dialogHelper", "dom", "components/libraryoptionseditor/libra var isCreating = false; return editor; -}); \ No newline at end of file +}); diff --git a/src/components/recordingcreator/recordinghelper.js b/src/components/recordingcreator/recordinghelper.js index a8359b4d4..8c56b578c 100644 --- a/src/components/recordingcreator/recordinghelper.js +++ b/src/components/recordingcreator/recordinghelper.js @@ -37,7 +37,7 @@ define(['globalize', 'loading', 'connectionManager'], function (globalize, loadi confirm({ text: globalize.translate('MessageConfirmRecordingCancellation'), - primary: 'cancel', + primary: 'delete', confirmText: globalize.translate('HeaderCancelRecording'), cancelText: globalize.translate('HeaderKeepRecording') @@ -62,7 +62,7 @@ define(['globalize', 'loading', 'connectionManager'], function (globalize, loadi confirm({ text: globalize.translate('MessageConfirmRecordingCancellation'), - primary: 'cancel', + primary: 'delete', confirmText: globalize.translate('HeaderCancelSeries'), cancelText: globalize.translate('HeaderKeepSeries') diff --git a/src/components/subtitleeditor/subtitleeditor.js b/src/components/subtitleeditor/subtitleeditor.js index e4742a894..27055f597 100644 --- a/src/components/subtitleeditor/subtitleeditor.js +++ b/src/components/subtitleeditor/subtitleeditor.js @@ -74,7 +74,7 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings', title: globalize.translate('ConfirmDeletion'), text: msg, confirmText: globalize.translate('Delete'), - primary: 'cancel' + primary: 'delete' }).then(function () { @@ -523,4 +523,4 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings', return { show: showEditor }; -}); \ No newline at end of file +}); diff --git a/src/components/themes/appletv/theme.css b/src/components/themes/appletv/theme.css index 8b4d543b9..35b388d1c 100644 --- a/src/components/themes/appletv/theme.css +++ b/src/components/themes/appletv/theme.css @@ -101,6 +101,11 @@ html { background: #0cb0e8 } +.button-delete { + background: rgb(247, 0, 0); + color: rgba(255, 255, 255, .87) +} + .checkboxLabel { color: inherit } diff --git a/src/components/themes/blueradiance/theme.css b/src/components/themes/blueradiance/theme.css index 9413e6a66..4740fc5ee 100644 --- a/src/components/themes/blueradiance/theme.css +++ b/src/components/themes/blueradiance/theme.css @@ -88,6 +88,11 @@ html { color: #fff } +.button-delete { + background: rgb(247, 0, 0); + color: rgba(255, 255, 255, .87) +} + .checkboxLabel { color: inherit } diff --git a/src/components/themes/dark/theme.css b/src/components/themes/dark/theme.css index 78cd4c8cf..161c8d6df 100644 --- a/src/components/themes/dark/theme.css +++ b/src/components/themes/dark/theme.css @@ -69,6 +69,11 @@ html { color: #fff } +.button-delete { + background: rgb(247, 0, 0); + color: rgba(255, 255, 255, .87) +} + .checkboxLabel { color: inherit } diff --git a/src/components/themes/emby/theme.css b/src/components/themes/emby/theme.css index 890ee0a69..d018ec715 100644 --- a/src/components/themes/emby/theme.css +++ b/src/components/themes/emby/theme.css @@ -69,6 +69,11 @@ html { color: #fff } +.button-delete { + background: rgb(247, 0, 0); + color: rgba(255, 255, 255, .87) +} + .checkboxLabel { color: inherit } diff --git a/src/components/themes/light/theme.css b/src/components/themes/light/theme.css index 0752fbf5c..f7cc4da9f 100644 --- a/src/components/themes/light/theme.css +++ b/src/components/themes/light/theme.css @@ -84,6 +84,11 @@ html { background: #0cb0e8 } +.button-delete { + background: rgb(247, 0, 0); + color: rgba(255, 255, 255, .87) +} + .checkboxLabel { color: inherit } diff --git a/src/components/themes/purple-haze/theme.css b/src/components/themes/purple-haze/theme.css index 4f99a0d90..684ac96f1 100644 --- a/src/components/themes/purple-haze/theme.css +++ b/src/components/themes/purple-haze/theme.css @@ -143,6 +143,11 @@ a[data-role=button] { background: #ff77f1 } +.button-delete { + background: rgb(247, 0, 0); + color: rgba(255, 255, 255, .87) +} + #btnResetPassword, .btnForgotPassword, .btnCancel, diff --git a/src/components/themes/wmc/theme.css b/src/components/themes/wmc/theme.css index 376541f39..239e920a3 100644 --- a/src/components/themes/wmc/theme.css +++ b/src/components/themes/wmc/theme.css @@ -94,6 +94,11 @@ html { color: #fff } +.button-delete { + background: rgb(247, 0, 0); + color: rgba(255, 255, 255, .87) +} + .checkboxLabel { color: inherit } diff --git a/src/controllers/dashboardpage.js b/src/controllers/dashboardpage.js index 510f6d1b6..339145ca4 100644 --- a/src/controllers/dashboardpage.js +++ b/src/controllers/dashboardpage.js @@ -697,7 +697,7 @@ define(["datetime", "events", "itemHelper", "serverNotifications", "dom", "globa title: globalize.translate("HeaderRestart"), text: globalize.translate("MessageConfirmRestart"), confirmText: globalize.translate("ButtonRestart"), - primary: "cancel" + primary: "delete" }).then(function () { var page = dom.parentWithClass(btn, "page"); buttonEnabled(page.querySelector("#btnRestartServer"), false); @@ -712,7 +712,7 @@ define(["datetime", "events", "itemHelper", "serverNotifications", "dom", "globa title: globalize.translate("HeaderShutdown"), text: globalize.translate("MessageConfirmShutdown"), confirmText: globalize.translate("ButtonShutdown"), - primary: "cancel" + primary: "delete" }).then(function () { var page = dom.parentWithClass(btn, "page"); buttonEnabled(page.querySelector("#btnRestartServer"), false); diff --git a/src/controllers/devices.js b/src/controllers/devices.js index ef24f1917..d50f9ce7e 100644 --- a/src/controllers/devices.js +++ b/src/controllers/devices.js @@ -12,7 +12,7 @@ define(["loading", "dom", "libraryMenu", "globalize", "scripts/imagehelper", "hu text: msg, title: globalize.translate("HeaderDeleteDevice"), confirmText: globalize.translate("ButtonDelete"), - primary: "cancel" + primary: "delete" }).then(function() { loading.show(), ApiClient.ajax({ type: "DELETE", @@ -112,4 +112,4 @@ define(["loading", "dom", "libraryMenu", "globalize", "scripts/imagehelper", "hu loadData(this) }) } -}); \ No newline at end of file +}); diff --git a/src/controllers/installedplugins.js b/src/controllers/installedplugins.js index 40de0cc19..f9653fe26 100644 --- a/src/controllers/installedplugins.js +++ b/src/controllers/installedplugins.js @@ -7,7 +7,7 @@ define(["loading", "libraryMenu", "dom", "globalize", "cardStyle", "emby-button" confirm({ title: globalize.translate("UninstallPluginHeader"), text: msg, - primary: "cancel", + primary: "delete", confirmText: globalize.translate("UninstallPluginHeader") }).then(function() { loading.show(); diff --git a/src/controllers/medialibrarypage.js b/src/controllers/medialibrarypage.js index 405d38bfa..6ce5f7fac 100644 --- a/src/controllers/medialibrarypage.js +++ b/src/controllers/medialibrarypage.js @@ -1,48 +1,61 @@ -define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "globalize", "dom", "indicators", "scripts/imagehelper", "cardStyle", "emby-itemrefreshindicator"], function($, appHost, taskButton, loading, libraryMenu, globalize, dom, indicators, imageHelper) { +define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "globalize", "dom", "indicators", "scripts/imagehelper", "cardStyle", "emby-itemrefreshindicator"], function ($, appHost, taskButton, loading, libraryMenu, globalize, dom, indicators, imageHelper) { "use strict"; function addVirtualFolder(page) { - require(["medialibrarycreator"], function(medialibrarycreator) { - (new medialibrarycreator).show({ - collectionTypeOptions: getCollectionTypeOptions().filter(function(f) { + require(["medialibrarycreator"], function (medialibrarycreator) { + new medialibrarycreator().show({ + collectionTypeOptions: getCollectionTypeOptions().filter(function (f) { return !f.hidden; }), refresh: shouldRefreshLibraryAfterChanges(page) - }).then(function(hasChanges) { - hasChanges && reloadLibrary(page); - }) - }) + }).then(function (hasChanges) { + if (hasChanges) { + reloadLibrary(page); + } + }); + }); } function editVirtualFolder(page, virtualFolder) { - require(["medialibraryeditor"], function(medialibraryeditor) { - (new medialibraryeditor).show({ + require(["medialibraryeditor"], function (medialibraryeditor) { + new medialibraryeditor().show({ refresh: shouldRefreshLibraryAfterChanges(page), library: virtualFolder - }).then(function(hasChanges) { - hasChanges && reloadLibrary(page); - }) - }) + }).then(function (hasChanges) { + if (hasChanges) { + reloadLibrary(page); + } + }); + }); } function deleteVirtualFolder(page, virtualFolder) { var msg = globalize.translate("MessageAreYouSureYouWishToRemoveMediaFolder"); + if (virtualFolder.Locations.length) { msg += "

" + globalize.translate("MessageTheFollowingLocationWillBeRemovedFromLibrary") + "

"; msg += virtualFolder.Locations.join("
"); } - require(["confirm"], function(confirm) { - confirm(msg, globalize.translate("HeaderRemoveMediaFolder")).then(function() { + + require(["confirm"], function (confirm) { + confirm({ + + text: msg, + title: globalize.translate('HeaderRemoveMediaFolder'), + confirmText: globalize.translate('Delete'), + primary: 'delete' + + }).then(function () { var refreshAfterChange = shouldRefreshLibraryAfterChanges(page); - ApiClient.removeVirtualFolder(virtualFolder.Name, refreshAfterChange).then(function() { + ApiClient.removeVirtualFolder(virtualFolder.Name, refreshAfterChange).then(function () { reloadLibrary(page); - }) - }) - }) + }); + }); + }); } function refreshVirtualFolder(page, virtualFolder) { - require(["refreshDialog"], function(refreshDialog) { + require(["refreshDialog"], function (refreshDialog) { new refreshDialog({ itemIds: [virtualFolder.ItemId], serverId: ApiClient.serverId(), @@ -52,14 +65,14 @@ define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "gl } function renameVirtualFolder(page, virtualFolder) { - require(["prompt"], function(prompt) { + require(["prompt"], function (prompt) { prompt({ label: globalize.translate("LabelNewName"), confirmText: globalize.translate("ButtonRename") - }).then(function(newName) { + }).then(function (newName) { if (newName && newName != virtualFolder.Name) { var refreshAfterChange = shouldRefreshLibraryAfterChanges(page); - ApiClient.renameVirtualFolder(virtualFolder.Name, newName, refreshAfterChange).then(function() { + ApiClient.renameVirtualFolder(virtualFolder.Name, newName, refreshAfterChange).then(function () { reloadLibrary(page); }); } @@ -97,24 +110,29 @@ define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "gl id: "refresh", ironIcon: "refresh" }); - require(["actionsheet"], function(actionsheet) { + + require(["actionsheet"], function (actionsheet) { actionsheet.show({ items: menuItems, positionTo: elem, - callback: function(resultId) { + callback: function (resultId) { switch (resultId) { case "edit": editVirtualFolder(page, virtualFolder); break; + case "editimages": editImages(page, virtualFolder); break; + case "rename": renameVirtualFolder(page, virtualFolder); break; + case "delete": deleteVirtualFolder(page, virtualFolder); break; + case "refresh": refreshVirtualFolder(page, virtualFolder); } @@ -125,7 +143,7 @@ define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "gl function reloadLibrary(page) { loading.show(); - ApiClient.getVirtualFolders().then(function(result) { + ApiClient.getVirtualFolders().then(function (result) { reloadVirtualFolders(page, result); }); } @@ -148,36 +166,40 @@ define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "gl for (var i = 0; i < virtualFolders.length; i++) { var virtualFolder = virtualFolders[i]; - html += getVirtualFolderHtml(page, virtualFolder, i) + html += getVirtualFolderHtml(page, virtualFolder, i); } + var divVirtualFolders = page.querySelector("#divVirtualFolders"); divVirtualFolders.innerHTML = html; divVirtualFolders.classList.add("itemsContainer"); divVirtualFolders.classList.add("vertical-wrap"); - $(".btnCardMenu", divVirtualFolders).on("click", function() { + $(".btnCardMenu", divVirtualFolders).on("click", function () { showCardMenu(page, this, virtualFolders); }); - divVirtualFolders.querySelector(".addLibrary").addEventListener("click", function() { + divVirtualFolders.querySelector(".addLibrary").addEventListener("click", function () { addVirtualFolder(page); }); - $(".editLibrary", divVirtualFolders).on("click", function() { + $(".editLibrary", divVirtualFolders).on("click", function () { var card = $(this).parents(".card")[0]; var index = parseInt(card.getAttribute("data-index")); var virtualFolder = virtualFolders[index]; - virtualFolder.ItemId && editVirtualFolder(page, virtualFolder); + + if (virtualFolder.ItemId) { + editVirtualFolder(page, virtualFolder); + } }); loading.hide(); } function editImages(page, virtualFolder) { - require(["imageEditor"], function(imageEditor) { + require(["imageEditor"], function (imageEditor) { imageEditor.show({ itemId: virtualFolder.ItemId, serverId: ApiClient.serverId() - }).then(function() { + }).then(function () { reloadLibrary(page); }); - }) + }); } function getLink(text, url) { @@ -214,25 +236,32 @@ define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "gl name: globalize.translate("FolderTypeUnset"), value: "mixed", message: globalize.translate("MessageUnsetContentHelp") - }] + }]; } function getVirtualFolderHtml(page, virtualFolder, index) { var html = ""; var style = ""; - page.classList.contains("wizardPage") && (style += "min-width:33.3%;"); + + if (page.classList.contains("wizardPage")) { + style += "min-width:33.3%;"; + } + html += '
'; html += '
'; html += '
'; html += '
'; html += '
'; var imgUrl = ""; + if (virtualFolder.PrimaryImageItemId) { imgUrl = ApiClient.getScaledImageUrl(virtualFolder.PrimaryImageItemId, { type: "Primary" }); } + var hasCardImageContainer; + if (imgUrl) { html += '
"; hasCardImageContainer = true; @@ -241,38 +270,60 @@ define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "gl html += '' + (virtualFolder.icon || imageHelper.getLibraryIcon(virtualFolder.CollectionType)) + ""; hasCardImageContainer = true; } + if (hasCardImageContainer) { html += '
'; html += '
'; html += "
"; html += "
"; } + if (!imgUrl && virtualFolder.showNameWithIcon) { html += '

'; html += '' + (virtualFolder.icon || imageHelper.getLibraryIcon(virtualFolder.CollectionType)) + ""; - virtualFolder.showNameWithIcon && (html += '
', html += virtualFolder.Name, html += "
"); + + if (virtualFolder.showNameWithIcon) { + html += '
'; + html += virtualFolder.Name; + html += "
"; + } + html += "

"; } - html += "
"; - html += "
"; - html += '
'; - // always show menu unless explicitly hidden + html += "
"; + html += "
"; + html += '
'; // always show menu unless explicitly hidden + if (virtualFolder.showMenu !== false) { html += '
'; html += ''; html += "
"; } + html += "
"; - virtualFolder.showNameWithIcon ? html += " " : html += virtualFolder.Name; + + if (virtualFolder.showNameWithIcon) { + html += " "; + } else { + html += virtualFolder.Name; + } + html += "
"; - var typeName = getCollectionTypeOptions().filter(function(t) { - return t.value == virtualFolder.CollectionType + var typeName = getCollectionTypeOptions().filter(function (t) { + return t.value == virtualFolder.CollectionType; })[0]; typeName = typeName ? typeName.name : globalize.translate("FolderTypeUnset"); html += "
"; - virtualFolder.showType === false ? html += " " : html += typeName; + + if (virtualFolder.showType === false) { + html += " "; + } else { + html += typeName; + } + html += "
"; + if (virtualFolder.showLocations === false) { html += "
"; html += " "; @@ -286,6 +337,7 @@ define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "gl html += globalize.translate("NumLocationsValue", virtualFolder.Locations.length); html += "
"; } + html += "
"; html += "
"; html += ""; @@ -305,18 +357,18 @@ define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "gl }, { href: "metadatanfo.html", name: globalize.translate("TabNfoSettings") - }] + }]; } window.WizardLibraryPage = { - next: function() { - Dashboard.navigate("wizardsettings.html") + next: function () { + Dashboard.navigate("wizardsettings.html"); } }; - pageClassOn("pageshow", "mediaLibraryPage", function() { + pageClassOn("pageshow", "mediaLibraryPage", function () { reloadLibrary(this); }); - pageIdOn("pageshow", "mediaLibraryPage", function() { + pageIdOn("pageshow", "mediaLibraryPage", function () { libraryMenu.setTabs("librarysetup", 0, getTabs); var page = this; taskButton({ @@ -326,7 +378,7 @@ define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "gl button: page.querySelector(".btnRefresh") }); }); - pageIdOn("pagebeforehide", "mediaLibraryPage", function() { + pageIdOn("pagebeforehide", "mediaLibraryPage", function () { var page = this; taskButton({ mode: "off", diff --git a/src/controllers/userprofilespage.js b/src/controllers/userprofilespage.js index c0d1d0d87..f76bb35e6 100644 --- a/src/controllers/userprofilespage.js +++ b/src/controllers/userprofilespage.js @@ -9,7 +9,7 @@ define(["loading", "dom", "globalize", "humanedate", "paper-icon-button-light", title: globalize.translate("DeleteUser"), text: msg, confirmText: globalize.translate("ButtonDelete"), - primary: "cancel" + primary: "delete" }).then(function () { loading.show(); ApiClient.deleteUser(id).then(function () { @@ -207,7 +207,7 @@ define(["loading", "dom", "globalize", "humanedate", "paper-icon-button-light", page.querySelector(".pending").innerHTML = users.map(getPendingUserHtml).join(""); } - + // TODO cvium: maybe reuse for invitation system function cancelAuthorization(page, id) { loading.show(); @@ -230,7 +230,7 @@ define(["loading", "dom", "globalize", "humanedate", "paper-icon-button-light", // TODO cvium renderPendingGuests(page, []); // ApiClient.getJSON(ApiClient.getUrl("Connect/Pending")).then(function (pending) { - // + // // }); }