Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tag support to list view #6020

Merged
merged 3 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/components/router/appRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,16 @@ class AppRouter {
return url;
}

if (item === 'tag') {
url = `#/list.html?type=tag&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}`;
Expand Down
6 changes: 5 additions & 1 deletion src/controllers/itemDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1309,8 +1309,12 @@ function renderTags(page, item) {
}

tags.forEach(tag => {
const href = appRouter.getRouteUrl('tag', {
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>'
);
Expand Down
13 changes: 9 additions & 4 deletions src/controllers/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}));
}

Expand Down Expand Up @@ -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', 'tag' ].includes(params.type)) {
return Promise.resolve(null);
}

Expand Down Expand Up @@ -726,6 +727,10 @@ class ItemsView {
if (params.type === 'Video') {
return globalize.translate('Videos');
}

if (params.tag) {
return params.tag;
}
}

function play() {
Expand Down Expand Up @@ -1203,7 +1208,7 @@ class ItemsView {
showTitle = true;
} else if (showTitle === 'false') {
showTitle = false;
} else if (params.type === 'Programs' || params.type === 'Recordings' || params.type === 'Person' || params.type === 'nextup' || params.type === 'Audio' || params.type === 'MusicAlbum' || params.type === 'MusicArtist') {
} else if ([ 'Audio', 'MusicAlbum', 'MusicArtist', 'Person', 'Programs', 'Recordings', 'nextup', 'tag' ].includes(params.type)) {
showTitle = true;
} else if (item && item.Type !== 'PhotoAlbum') {
showTitle = true;
Expand All @@ -1220,7 +1225,7 @@ class ItemsView {
}

return {
showTitle: showTitle,
showTitle,
showYear: userSettings.get(basekey + '-showYear') !== 'false',
imageType: imageType || 'primary',
viewType: userSettings.get(basekey + '-viewType') || 'images'
Expand Down
Loading