1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Add tag support to list view

This commit is contained in:
Bill Thornton 2024-09-04 08:39:10 -04:00
parent f591296bfe
commit d01cfa498b
3 changed files with 25 additions and 5 deletions

View file

@ -673,6 +673,16 @@ class AppRouter {
return url;
}
if (item === 'tag') {
url = `#/list.html?tag=${encodeURIComponent(options.tag)}&serverId=${serverId}`;
if (options.parentId) {
url += '&parentId=' + options.parentId;
}
return url;
}
if (context !== 'folders' && !itemHelper.isLocalItem(item)) {
if (item.CollectionType == CollectionType.Movies) {
url = `#/movies.html?topParentId=${item.Id}&collectionType=${item.CollectionType}`;

View file

@ -1080,7 +1080,7 @@ function renderDetails(page, item, apiClient, context) {
renderLinks(page, item);
}
renderTags(page, item);
renderTags(page, item, context);
renderSeriesAirTime(page, item);
}
@ -1299,7 +1299,7 @@ function renderSeriesAirTime(page, item) {
}
}
function renderTags(page, item) {
function renderTags(page, item, context) {
const itemTags = page.querySelector('.itemTags');
const tagElements = [];
let tags = item.Tags || [];
@ -1309,8 +1309,13 @@ function renderTags(page, item) {
}
tags.forEach(tag => {
const href = appRouter.getRouteUrl('tag', {
context,
tag,
serverId: item.ServerId
});
tagElements.push(
`<a href="#/search.html?query=${encodeURIComponent(tag)}" class="button-link emby-button" is="emby-linkbutton">`
`<a href="${href}" class="button-link emby-button" is="emby-linkbutton">`
+ escapeHtml(tag)
+ '</a>'
);

View file

@ -284,7 +284,8 @@ function getItems(instance, params, item, sortBy, startIndex, limit) {
Recursive: true,
IsFavorite: params.IsFavorite === 'true' || null,
ArtistIds: params.artistId || null,
SortBy: sortBy
SortBy: sortBy,
Tags: params.tag || null
}));
}
@ -333,7 +334,7 @@ function getItems(instance, params, item, sortBy, startIndex, limit) {
}
function getItem(params) {
if (params.type === 'Recordings' || params.type === 'Programs' || params.type === 'nextup') {
if ([ 'Recordings', 'Programs', 'nextup' ].includes(params.type) || params.tag) {
return Promise.resolve(null);
}
@ -726,6 +727,10 @@ class ItemsView {
if (params.type === 'Video') {
return globalize.translate('Videos');
}
if (params.tag) {
return params.tag;
}
}
function play() {