add delete to multi-select

This commit is contained in:
Luke Pulverenti 2016-01-19 14:03:46 -05:00
parent d541bebde0
commit c37b8b12ed
6 changed files with 48 additions and 22 deletions

View File

@ -1159,7 +1159,7 @@
performAdvancedRefresh(page);
break;
case 'delete':
LibraryBrowser.deleteItem(currentItem.Id);
LibraryBrowser.deleteItems([currentItem.Id]);
break;
case 'editimages':
LibraryBrowser.editImages(currentItem.Id);

View File

@ -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');

View File

@ -469,7 +469,7 @@
PlaylistManager.showPanel([itemId]);
break;
case 'delete':
LibraryBrowser.deleteItem(itemId);
LibraryBrowser.deleteItems([itemId]);
break;
case 'download':
{
@ -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;

View File

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

View File

@ -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.",

View File

@ -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.",