update listviews

This commit is contained in:
Luke Pulverenti 2016-07-17 12:59:14 -04:00
parent c87b1304da
commit d9c694f564
13 changed files with 149 additions and 124 deletions

View file

@ -15,12 +15,12 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.4.90",
"_release": "1.4.90",
"version": "1.4.91",
"_release": "1.4.91",
"_resolution": {
"type": "version",
"tag": "1.4.90",
"commit": "36704279e05a90730af96c13b16c60ecc30cdce8"
"tag": "1.4.91",
"commit": "a4c5466d5a59e57b157aa941fcadb1e0df602f75"
},
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.0",

View file

@ -112,8 +112,8 @@
} else {
dialogOptions.modal = false;
dialogOptions.entryAnimationDuration = 160;
dialogOptions.exitAnimationDuration = 200;
dialogOptions.entryAnimationDuration = 140;
dialogOptions.exitAnimationDuration = 180;
dialogOptions.autoFocus = false;
}

View file

@ -40,10 +40,18 @@
return apiClient.getItem(apiClient.getCurrentUserId(), id);
}
function showContextMenu(button) {
function showContextMenu(button, itemsContainer) {
getItem(button).then(function (item) {
var playlistId = itemsContainer.getAttribute('data-playlistid');
var collectionId = itemsContainer.getAttribute('data-collectionid');
if (playlistId) {
var elem = parentWithAttribute(button, 'data-playlistitemid');
item.PlaylistItemId = elem ? elem.getAttribute('data-playlistitemid') : null;
}
require(['itemContextMenu'], function (itemContextMenu) {
itemContextMenu.show({
positionTo: button,
@ -52,13 +60,23 @@
queue: true,
playAllFromHere: !item.IsFolder,
queueAllFromHere: !item.IsFolder,
identify: false
identify: false,
playlistId: playlistId,
collectionId: collectionId
}).then(function(result) {
}).then(function (result) {
if (result.command == 'playallfromhere' || result.command == 'queueallfromhere') {
itemShortcuts.execute(button, result.command);
}
else if (result.command == 'removefromplaylist' || result.command == 'removefromcollection') {
itemsContainer.dispatchEvent(new CustomEvent('needsrefresh', {
detail: {},
cancelable: false,
bubbles: true
}));
}
});
});
});
@ -66,9 +84,11 @@
function onClick(e) {
var itemsContainer = this;
var menuButton = parentWithClass(e.target, 'menuButton');
if (menuButton) {
showContextMenu(menuButton);
showContextMenu(menuButton, itemsContainer);
e.stopPropagation();
return false;
}

View file

@ -12,6 +12,8 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
var serverId = item.ServerId;
var apiClient = connectionManager.getApiClient(serverId);
var canPlay = playbackManager.canPlay(item);
return apiClient.getCurrentUser().then(function (user) {
var commands = [];
@ -42,7 +44,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
if (!isTheater) {
commands.push({
name: globalize.translate('sharedcomponents#Edit'),
name: globalize.translate('sharedcomponents#EditInfo'),
id: 'edit'
});
commands.push({
@ -85,7 +87,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
}
if (options.open !== false) {
if (item.Type != 'Timer') {
if (item.Type != 'Timer' && item.Type != 'Audio') {
commands.push({
name: globalize.translate('sharedcomponents#Open'),
id: 'open'
@ -93,34 +95,36 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
}
}
if (options.play !== false) {
commands.push({
name: globalize.translate('sharedcomponents#Play'),
id: 'resume'
});
}
if (options.playAllFromHere) {
commands.push({
name: globalize.translate('sharedcomponents#PlayAllFromHere'),
id: 'playallfromhere'
});
}
if (playbackManager.canQueueMediaType(item.MediaType)) {
if (options.queue !== false) {
if (canPlay) {
if (options.play !== false) {
commands.push({
name: globalize.translate('sharedcomponents#Queue'),
id: 'queue'
name: globalize.translate('sharedcomponents#Play'),
id: 'resume'
});
}
if (options.queueAllFromHere) {
if (options.playAllFromHere) {
commands.push({
name: globalize.translate('sharedcomponents#QueueAllFromHere'),
id: 'queueallfromhere'
name: globalize.translate('sharedcomponents#PlayAllFromHere'),
id: 'playallfromhere'
});
}
if (playbackManager.canQueueMediaType(item.MediaType)) {
if (options.queue !== false) {
commands.push({
name: globalize.translate('sharedcomponents#Queue'),
id: 'queue'
});
}
if (options.queueAllFromHere) {
commands.push({
name: globalize.translate('sharedcomponents#QueueAllFromHere'),
id: 'queueallfromhere'
});
}
}
}
if (item.Type == 'Program' && (!item.TimerId && !item.SeriesTimerId)) {
@ -141,6 +145,20 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
}
}
if (item.PlaylistItemId && options.playlistId) {
commands.push({
name: globalize.translate('sharedcomponents#RemoveFromPlaylist'),
id: 'removefromplaylist'
});
}
if (options.collectionId) {
commands.push({
name: globalize.translate('sharedcomponents#RemoveFromCollection'),
id: 'removefromcollection'
});
}
if (options.share !== false) {
if (itemHelper.canShare(user, item)) {
commands.push({
@ -197,7 +215,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
};
}
function executeCommand(item, id) {
function executeCommand(item, id, options) {
var itemId = item.Id;
var serverId = item.ServerId;
@ -378,6 +396,37 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
getResolveFunction(resolve, id)();
break;
}
case 'removefromplaylist':
apiClient.ajax({
url: apiClient.getUrl('Playlists/' + options.playlistId + '/Items', {
EntryIds: [item.PlaylistItemId].join(',')
}),
type: 'DELETE'
}).then(function () {
getResolveFunction(resolve, id, true)();
});
break;
case 'removefromcollection':
apiClient.ajax({
type: "DELETE",
url: apiClient.getUrl("Collections/" + options.collectionId + "/Items", {
Ids: [item.Id].join(',')
})
}).then(function () {
getResolveFunction(resolve, id, true)();
});
break;
default:
reject();
break;
@ -464,7 +513,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
positionTo: options.positionTo
}).then(function (id) {
executeCommand(options.item, id).then(resolve);
executeCommand(options.item, id, options).then(resolve);
}, reject);
});
});

View file

@ -237,6 +237,10 @@ define(['datetime', 'globalize', 'embyRouter', 'material-icons', 'css!./mediainf
miscInfo.push(item.Width + "x" + item.Height);
}
if (item.Type == 'Audio' && item.Container) {
miscInfo.push(item.Container);
}
html += miscInfo.map(function (m) {
return getMediaInfoItem(m);
}).join('');

View file

@ -105,10 +105,12 @@
"Shuffle": "Shuffle",
"Identify": "Identify",
"EditImages": "Edit Images",
"EditInfo": "Edit Info",
"Sync": "Sync",
"InstantMix": "Instant Mix",
"ViewAlbum": "View Album",
"ViewArtist": "View Artist",
"QueueAllFromHere": "Queue All from Here",
"PlayAllFromHere": "Play All from Here"
"PlayAllFromHere": "Play All from Here",
"RemoveFromPlaylist": "Remove from Playlist"
}