diff --git a/src/components/router/appRouter.js b/src/components/router/appRouter.js index 5688ecd603..9ce5616d6a 100644 --- a/src/components/router/appRouter.js +++ b/src/components/router/appRouter.js @@ -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}`; diff --git a/src/controllers/itemDetails/index.js b/src/controllers/itemDetails/index.js index 56ef667d53..1611394b5a 100644 --- a/src/controllers/itemDetails/index.js +++ b/src/controllers/itemDetails/index.js @@ -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( - `` + `` + escapeHtml(tag) + '' ); diff --git a/src/controllers/list.js b/src/controllers/list.js index 02da709c03..ab0a96c659 100644 --- a/src/controllers/list.js +++ b/src/controllers/list.js @@ -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() {