From 6dfbdaa13a8b89f53be22cb846395ab56fcbf646 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 22 Jul 2016 01:38:01 -0400 Subject: [PATCH] display more from artist on album page --- .../itemhovermenu/itemhovermenu.js | 4 ++ dashboard-ui/itemdetails.html | 14 +++-- dashboard-ui/scripts/itemdetailpage.js | 61 ++++++++++++++++++- dashboard-ui/strings/en-US.json | 3 +- 4 files changed, 73 insertions(+), 9 deletions(-) diff --git a/dashboard-ui/bower_components/emby-webcomponents/itemhovermenu/itemhovermenu.js b/dashboard-ui/bower_components/emby-webcomponents/itemhovermenu/itemhovermenu.js index c13168ab0d..81b90a0c26 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/itemhovermenu/itemhovermenu.js +++ b/dashboard-ui/bower_components/emby-webcomponents/itemhovermenu/itemhovermenu.js @@ -173,6 +173,10 @@ var dataElement = dom.parentWithAttribute(elem, 'data-id'); + if (!dataElement) { + return; + } + var id = dataElement.getAttribute('data-id'); var type = dataElement.getAttribute('data-type'); diff --git a/dashboard-ui/itemdetails.html b/dashboard-ui/itemdetails.html index 97ad467dd3..085955278e 100644 --- a/dashboard-ui/itemdetails.html +++ b/dashboard-ui/itemdetails.html @@ -74,7 +74,7 @@

${HeaderNextUp}

-
+

@@ -88,7 +88,7 @@

${HeaderAdditionalParts}

-
+

@@ -110,13 +110,17 @@

${HeaderSpecialFeatures}

-
+

${HeaderMusicVideos}

-
+
+
+
+

+

@@ -176,7 +180,7 @@

${HeaderThemeVideos}

-
+
diff --git a/dashboard-ui/scripts/itemdetailpage.js b/dashboard-ui/scripts/itemdetailpage.js index 49720a9205..56f36d7b1a 100644 --- a/dashboard-ui/scripts/itemdetailpage.js +++ b/dashboard-ui/scripts/itemdetailpage.js @@ -442,6 +442,7 @@ function renderDetails(page, item, context, isStatic) { renderSimilarItems(page, item, context); + renderMoreFromItems(page, item); if (!isStatic) { renderSiblingLinks(page, item, context); @@ -721,6 +722,63 @@ return enableScrollX() ? 'overflowBackdrop' : 'detailPage169'; } + function renderMoreFromItems(page, item) { + + var moreFromSection = page.querySelector('#moreFromSection'); + + if (!moreFromSection) { + return; + } + + if (item.Type != 'MusicAlbum' || !item.AlbumArtists || !item.AlbumArtists.length) { + moreFromSection.classList.add('hide'); + return; + } + + ApiClient.getItems(Dashboard.getCurrentUserId(), { + + IncludeItemTypes: "MusicAlbum", + ArtistIds: item.AlbumArtists[0].Id, + Recursive: true, + ExcludeItemIds: item.Id + + }).then(function(result) { + + if (!result.Items.length) { + moreFromSection.classList.add('hide'); + return; + } + moreFromSection.classList.remove('hide'); + + moreFromSection.querySelector('.moreFromHeader').innerHTML = Globalize.translate('MoreFromValue', item.AlbumArtists[0].Name); + + var html = ''; + + if (enableScrollX()) { + html += '
'; + } else { + html += '
'; + } + + var shape = item.Type == "MusicAlbum" || item.Type == "MusicArtist" ? getSquareShape() : getPortraitShape(); + + html += LibraryBrowser.getPosterViewHtml({ + items: result.Items, + shape: shape, + showParentTitle: item.Type == "MusicAlbum", + centerText: true, + showTitle: item.Type == "MusicAlbum" || item.Type == "Game" || item.Type == "MusicArtist", + coverImage: item.Type == "MusicAlbum" || item.Type == "MusicArtist", + overlayPlayButton: true + }); + html += '
'; + + var similarContent = page.querySelector('#moreFromItems'); + similarContent.innerHTML = html; + ImageLoader.lazyChildren(similarContent); + }); + } + function renderSimilarItems(page, item, context) { var similarCollapsible = page.querySelector('#similarCollapsible'); @@ -751,8 +809,6 @@ ApiClient.getSimilarItems(item.Id, options).then(function (result) { - var similarCollapsible = page.querySelector('#similarCollapsible'); - if (!result.Items.length) { similarCollapsible.classList.add('hide'); @@ -775,7 +831,6 @@ showParentTitle: item.Type == "MusicAlbum", centerText: true, showTitle: item.Type == "MusicAlbum" || item.Type == "Game" || item.Type == "MusicArtist", - borderless: item.Type == "Game", context: context, lazy: true, showDetailsMenu: true, diff --git a/dashboard-ui/strings/en-US.json b/dashboard-ui/strings/en-US.json index ea50b41d70..ad3e5df84d 100644 --- a/dashboard-ui/strings/en-US.json +++ b/dashboard-ui/strings/en-US.json @@ -2380,5 +2380,6 @@ "OptionUseSystemInstalledVersion": "Use system installed version", "OptionUseMyCustomVersion": "Use a custom version", "FFmpegSavePathNotFound": "We're unable to locate FFmpeg using the path you've entered. FFprobe is also required and must exist in the same folder. These components are normally bundled together in the same download. Please check the path and try again.", - "XmlTvPremiere": "By default, Emby will import {0} hours of guide data. Importing unlimited data requires an active Emby Premiere subscription." + "XmlTvPremiere": "By default, Emby will import {0} hours of guide data. Importing unlimited data requires an active Emby Premiere subscription.", + "MoreFromValue": "More from {0}" }