mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update listviews
This commit is contained in:
parent
b5734e3e93
commit
722a452b91
19 changed files with 277 additions and 155 deletions
|
@ -1,4 +1,4 @@
|
|||
define(['layoutManager', 'datetime', 'mediaInfo', 'backdrop', 'listView', 'scrollStyles'], function (layoutManager, datetime, mediaInfo, backdrop, listView) {
|
||||
define(['layoutManager', 'datetime', 'mediaInfo', 'backdrop', 'listView', 'itemContextMenu', 'itemHelper', 'scrollStyles'], function (layoutManager, datetime, mediaInfo, backdrop, listView, itemContextMenu, itemHelper) {
|
||||
|
||||
var currentItem;
|
||||
|
||||
|
@ -61,6 +61,19 @@
|
|||
}
|
||||
}
|
||||
|
||||
function getContextMenuOptions(item, button) {
|
||||
|
||||
return {
|
||||
item: item,
|
||||
open: false,
|
||||
play: false,
|
||||
queue: false,
|
||||
playAllFromHere: false,
|
||||
queueAllFromHere: false,
|
||||
positionTo: button
|
||||
};
|
||||
}
|
||||
|
||||
function reloadFromItem(page, params, item) {
|
||||
|
||||
currentItem = item;
|
||||
|
@ -128,7 +141,7 @@
|
|||
hideAll(page, 'btnPlayTrailer');
|
||||
}
|
||||
|
||||
if (LibraryBrowser.enableSync(item, user)) {
|
||||
if (itemHelper.canSync(user, item)) {
|
||||
hideAll(page, 'btnSync', true);
|
||||
} else {
|
||||
hideAll(page, 'btnSync');
|
||||
|
@ -178,11 +191,13 @@
|
|||
page.querySelector('.splitVersionContainer').classList.add('hide');
|
||||
}
|
||||
|
||||
if (LibraryBrowser.getMoreCommands(item, user).length > 0) {
|
||||
hideAll(page, 'btnMoreCommands', true);
|
||||
} else {
|
||||
hideAll(page, 'btnMoreCommands');
|
||||
}
|
||||
itemContextMenu.getCommands(getContextMenuOptions(item)).then(function (commands) {
|
||||
if (commands.length) {
|
||||
hideAll(page, 'btnMoreCommands', true);
|
||||
} else {
|
||||
hideAll(page, 'btnMoreCommands');
|
||||
}
|
||||
});
|
||||
|
||||
if (user.Policy.IsAdministrator) {
|
||||
page.querySelector('.chapterSettingsButton').classList.remove('hide');
|
||||
|
@ -2105,11 +2120,14 @@
|
|||
function onMoreCommandsClick() {
|
||||
var button = this;
|
||||
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
itemContextMenu.show(getContextMenuOptions(currentItem, button)).then(function (result) {
|
||||
|
||||
LibraryBrowser.showMoreCommands(button, currentItem.Id, currentItem.Type, LibraryBrowser.getMoreCommands(currentItem, user)).then(function () {
|
||||
if (result.deleted) {
|
||||
Emby.Page.goHome();
|
||||
|
||||
} else if (result.updated) {
|
||||
reload(view, params);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2192,11 +2210,6 @@
|
|||
}
|
||||
});
|
||||
|
||||
//var btnMore = page.querySelectorAll('.btnMoreCommands iron-icon');
|
||||
//for (var i = 0, length = btnMore.length; i < length; i++) {
|
||||
// btnMore[i].icon = AppInfo.moreIcon;
|
||||
//}
|
||||
|
||||
function onWebSocketMessage(e, data) {
|
||||
|
||||
var msg = data;
|
||||
|
|
|
@ -685,15 +685,6 @@
|
|||
});
|
||||
},
|
||||
|
||||
supportsEditing: function (itemType) {
|
||||
|
||||
if (itemType == "UserRootFolder" || /*itemType == "CollectionFolder" ||*/ itemType == "UserView" || itemType == 'Timer') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
getMoreCommands: function (item, user) {
|
||||
|
||||
var commands = [];
|
||||
|
@ -715,7 +706,7 @@
|
|||
|
||||
if (user.Policy.IsAdministrator) {
|
||||
|
||||
if (LibraryBrowser.supportsEditing(item.Type)) {
|
||||
if (itemHelper.canEdit(user, item.Type)) {
|
||||
commands.push('edit');
|
||||
}
|
||||
|
||||
|
@ -733,7 +724,7 @@
|
|||
commands.push('refresh');
|
||||
}
|
||||
|
||||
if (LibraryBrowser.enableSync(item, user)) {
|
||||
if (itemHelper.canSync(user, item)) {
|
||||
commands.push('sync');
|
||||
}
|
||||
|
||||
|
@ -747,34 +738,13 @@
|
|||
commands.push('share');
|
||||
}
|
||||
|
||||
if (LibraryBrowser.canIdentify(user, item.Type)) {
|
||||
if (itemHelper.canIdentify(user, item.Type)) {
|
||||
commands.push('identify');
|
||||
}
|
||||
|
||||
return commands;
|
||||
},
|
||||
|
||||
canIdentify: function (user, itemType) {
|
||||
|
||||
if (itemType == "Movie" ||
|
||||
itemType == "Trailer" ||
|
||||
itemType == "Series" ||
|
||||
itemType == "Game" ||
|
||||
itemType == "BoxSet" ||
|
||||
itemType == "Person" ||
|
||||
itemType == "Book" ||
|
||||
itemType == "MusicAlbum" ||
|
||||
itemType == "MusicArtist") {
|
||||
|
||||
if (user.Policy.IsAdministrator) {
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
deleteItems: function (itemIds) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
@ -1301,18 +1271,6 @@
|
|||
return html;
|
||||
},
|
||||
|
||||
enableSync: function (item, user) {
|
||||
if (AppInfo.isNativeApp && !Dashboard.capabilities().SupportsSync) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (user && !user.Policy.EnableSync) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return item.SupportsSync;
|
||||
},
|
||||
|
||||
getItemCommands: function (item, options) {
|
||||
|
||||
var itemCommands = [];
|
||||
|
@ -1321,9 +1279,7 @@
|
|||
// itemCommands.push('playmenu');
|
||||
//}
|
||||
|
||||
if (LibraryBrowser.supportsEditing(item.Type)) {
|
||||
itemCommands.push('edit');
|
||||
}
|
||||
itemCommands.push('edit');
|
||||
|
||||
if (item.LocalTrailerCount) {
|
||||
itemCommands.push('trailer');
|
||||
|
@ -1365,7 +1321,7 @@
|
|||
itemCommands.push('delete');
|
||||
}
|
||||
|
||||
if (LibraryBrowser.enableSync(item)) {
|
||||
if (itemHelper.canSync({ Policy: {} }, item)) {
|
||||
itemCommands.push('sync');
|
||||
}
|
||||
|
||||
|
|
|
@ -1478,7 +1478,7 @@
|
|||
|
||||
var categorySyncButtons = page.querySelectorAll('.categorySyncButton');
|
||||
for (var i = 0, length = categorySyncButtons.length; i < length; i++) {
|
||||
if (LibraryBrowser.enableSync(item, user)) {
|
||||
if (itemHelper.canSync(user, item)) {
|
||||
categorySyncButtons[i].classList.remove('hide');
|
||||
} else {
|
||||
categorySyncButtons[i].classList.add('hide');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue