Skip to content
Open
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
7 changes: 7 additions & 0 deletions src/controllers/itemDetails/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,13 @@ <h2 class="sectionTitle sectionTitle-cards padded-right">${HeaderScenes}</h2>
</div>
</div>

<div id="collectionsCollapsible" class="verticalSection detailVerticalSection hide">
<h2 class="sectionTitle sectionTitle-cards padded-right">${HeaderIncludedIn}</h2>
<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale no-padding" data-centerfocus="true">
<div id="includedInContent" is="emby-itemscontainer" class="scrollSlider focuscontainer-x itemsContainer includedInContent"></div>
</div>
</div>

<div id="similarCollapsible" class="verticalSection detailVerticalSection verticalSection-extrabottompadding hide">
<h2 class="sectionTitle sectionTitle-cards padded-right">${HeaderMoreLikeThis}</h2>
<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale no-padding" data-centerfocus="true">
Expand Down
42 changes: 42 additions & 0 deletions src/controllers/itemDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,7 @@ function renderTagline(page, item) {
}

function renderDetails(page, item, apiClient, context) {
renderItemCollections(page, item, apiClient, context);
renderSimilarItems(page, item, context);
renderMoreFromSeason(page, item, apiClient);
renderMoreFromArtist(page, item, apiClient);
Expand Down Expand Up @@ -1243,6 +1244,47 @@ function renderMoreFromArtist(view, item, apiClient) {
}
}

function renderItemCollections(page, item, apiClient, context) {
const section = page.querySelector('#collectionsCollapsible');

if (!section) {
return;
}

const query = {
userId: apiClient.getCurrentUserId(),
fields: 'PrimaryImageAspectRatio'
};

apiClient.getJSON(apiClient.getUrl(`Items/${item.Id}/Collections`, query)).then((result) => {
const items = result?.Items || [];

if (!items.length) {
section.classList.add('hide');
return;
}

section.classList.remove('hide');
cardBuilder.buildCards(items, {
parentContainer: section,
itemsContainer: section.querySelector('.includedInContent'),
shape: 'overflowPortrait',
sectionTitleTagName: 'h2',
scalable: true,
centerText: true,
showTitle: true,
showParentTitle: false,
overlayText: false,
overlayPlayButton: false,
coverImage: true,
showYear: false,
context
});
}).catch(() => {
section.classList.add('hide');
});
}

function renderSimilarItems(page, item, context) {
const similarCollapsible = page.querySelector('#similarCollapsible');

Expand Down
1 change: 1 addition & 0 deletions src/strings/en-gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@
"HeaderExternalIds": "External IDs",
"HeaderFeatureAccess": "Feature access",
"HeaderFetchImages": "Fetch Images",
"HeaderIncludedIn": "Included In",
"HeaderFetcherSettings": "Fetcher Settings",
"HeaderForKids": "For Kids",
"HeaderFrequentlyPlayed": "Frequently Played",
Expand Down
1 change: 1 addition & 0 deletions src/strings/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@
"HeaderError": "Error",
"HeaderExternalIds": "External IDs",
"HeaderFeatureAccess": "Feature access",
"HeaderIncludedIn": "Included In",
"HeaderFetcherSettings": "Fetcher Settings",
"HeaderFetchImages": "Fetch Images",
"HeaderForKids": "For Kids",
Expand Down
Loading