mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 19:38:20 -07:00
add delete to multi-select
This commit is contained in:
parent
d541bebde0
commit
c37b8b12ed
@ -1159,7 +1159,7 @@
|
||||
performAdvancedRefresh(page);
|
||||
break;
|
||||
case 'delete':
|
||||
LibraryBrowser.deleteItem(currentItem.Id);
|
||||
LibraryBrowser.deleteItems([currentItem.Id]);
|
||||
break;
|
||||
case 'editimages':
|
||||
LibraryBrowser.editImages(currentItem.Id);
|
||||
|
@ -834,27 +834,37 @@
|
||||
|
||||
});
|
||||
|
||||
|
||||
Dashboard.alert(Globalize.translate('MessageRefreshQueued'));
|
||||
},
|
||||
|
||||
deleteItem: function (itemId) {
|
||||
deleteItems: function (itemIds) {
|
||||
|
||||
// The timeout allows the flyout to close
|
||||
setTimeout(function () {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
var msg = Globalize.translate('ConfirmDeleteItem');
|
||||
var title = Globalize.translate('HeaderDeleteItem');
|
||||
|
||||
Dashboard.confirm(msg, Globalize.translate('HeaderDeleteItem'), function (result) {
|
||||
if (itemIds.length > 1) {
|
||||
msg = Globalize.translate('ConfirmDeleteItems');
|
||||
title = Globalize.translate('HeaderDeleteItems');
|
||||
}
|
||||
|
||||
Dashboard.confirm(msg, title, function (result) {
|
||||
|
||||
if (result) {
|
||||
ApiClient.deleteItem(itemId);
|
||||
|
||||
var promises = itemIds.map(function (itemId) {
|
||||
ApiClient.deleteItem(itemId);
|
||||
Events.trigger(LibraryBrowser, 'itemdeleting', [itemId]);
|
||||
}
|
||||
});
|
||||
|
||||
}, 250);
|
||||
resolve();
|
||||
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
editImages: function (itemId) {
|
||||
@ -991,7 +1001,7 @@
|
||||
PlaylistManager.showPanel([itemId]);
|
||||
break;
|
||||
case 'delete':
|
||||
LibraryBrowser.deleteItem(itemId);
|
||||
LibraryBrowser.deleteItems([itemId]);
|
||||
break;
|
||||
case 'download':
|
||||
{
|
||||
@ -1594,13 +1604,9 @@
|
||||
itemCommands.push('queuefromhere');
|
||||
}
|
||||
|
||||
// There's no detail page with a dedicated delete function
|
||||
if (item.Type == 'Playlist' || item.Type == 'BoxSet') {
|
||||
|
||||
if (item.CanDelete) {
|
||||
itemCommands.push('delete');
|
||||
}
|
||||
}
|
||||
|
||||
if (SyncManager.isAvailable(item)) {
|
||||
itemCommands.push('sync');
|
||||
@ -2892,7 +2898,7 @@
|
||||
var fireCallbackOnClose = false;
|
||||
var delay = browserInfo.animate ? 0 : 100;
|
||||
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
paperDialogHelper.open(dlg).then(function () {
|
||||
|
||||
if (options.callback && fireCallbackOnClose) {
|
||||
|
@ -469,7 +469,7 @@
|
||||
PlaylistManager.showPanel([itemId]);
|
||||
break;
|
||||
case 'delete':
|
||||
LibraryBrowser.deleteItem(itemId);
|
||||
LibraryBrowser.deleteItems([itemId]);
|
||||
break;
|
||||
case 'download':
|
||||
{
|
||||
@ -1025,7 +1025,7 @@
|
||||
|
||||
function showSelections(initialCard) {
|
||||
|
||||
require(['paper-checkbox'], function() {
|
||||
require(['paper-checkbox'], function () {
|
||||
var cards = document.querySelectorAll('.card');
|
||||
for (var i = 0, length = cards.length; i < length; i++) {
|
||||
showSelection(cards[i]);
|
||||
@ -1101,6 +1101,14 @@
|
||||
ironIcon: 'playlist-add'
|
||||
});
|
||||
|
||||
if (user.Policy.EnableContentDeletion) {
|
||||
items.push({
|
||||
name: Globalize.translate('ButtonDelete'),
|
||||
id: 'delete',
|
||||
ironIcon: 'delete'
|
||||
});
|
||||
}
|
||||
|
||||
if (user.Policy.EnableContentDownloading && AppInfo.supportsDownloading) {
|
||||
//items.push({
|
||||
// name: Globalize.translate('ButtonDownload'),
|
||||
@ -1149,6 +1157,12 @@
|
||||
PlaylistManager.showPanel(items);
|
||||
hideSelections();
|
||||
break;
|
||||
case 'delete':
|
||||
LibraryBrowser.deleteItems(items).then(function () {
|
||||
Dashboard.navigate('index.html');
|
||||
});
|
||||
hideSelections();
|
||||
break;
|
||||
case 'groupvideos':
|
||||
combineVersions($($.mobile.activePage)[0], items);
|
||||
break;
|
||||
|
@ -85,7 +85,8 @@
|
||||
ApiClient.getLiveTvRecordings({
|
||||
|
||||
userId: Dashboard.getCurrentUserId(),
|
||||
IsInProgress: true
|
||||
IsInProgress: true,
|
||||
Fields: 'CanDelete'
|
||||
|
||||
}).then(function (result) {
|
||||
|
||||
@ -97,7 +98,8 @@
|
||||
|
||||
userId: Dashboard.getCurrentUserId(),
|
||||
limit: 12,
|
||||
IsInProgress: false
|
||||
IsInProgress: false,
|
||||
Fields: 'CanDelete'
|
||||
|
||||
}).then(function (result) {
|
||||
|
||||
|
@ -355,6 +355,8 @@
|
||||
"ButtonBrowseOnlineImages": "Browse online images",
|
||||
"HeaderDeleteItem": "Delete Item",
|
||||
"ConfirmDeleteItem": "Deleting this item will delete it from both the file system and your media library. Are you sure you wish to continue?",
|
||||
"HeaderDeleteItems": "Delete Items",
|
||||
"ConfirmDeleteItems": "Deleting these items will delete them from both the file system and your media library. Are you sure you wish to continue?",
|
||||
"MessagePleaseEnterNameOrId": "Please enter a name or an external Id.",
|
||||
"MessageValueNotCorrect": "The value entered is not correct. Please try again.",
|
||||
"MessageItemSaved": "Item saved.",
|
||||
|
@ -359,6 +359,8 @@
|
||||
"ButtonBrowseOnlineImages": "Browse online images",
|
||||
"HeaderDeleteItem": "Delete Item",
|
||||
"ConfirmDeleteItem": "Deleting this item will delete it from both the file system and your media library. Are you sure you wish to continue?",
|
||||
"HeaderDeleteItems": "Delete Items",
|
||||
"ConfirmDeleteItems": "Deleting these items will delete them from both the file system and your media library. Are you sure you wish to continue?",
|
||||
"MessagePleaseEnterNameOrId": "Please enter a name or an external Id.",
|
||||
"MessageValueNotCorrect": "The value entered is not correct. Please try again.",
|
||||
"MessageItemSaved": "Item saved.",
|
||||
|
Loading…
Reference in New Issue
Block a user