diff --git a/dashboard-ui/itemDetails.html b/dashboard-ui/itemDetails.html index b1c4b32e90..655c0d2c21 100644 --- a/dashboard-ui/itemDetails.html +++ b/dashboard-ui/itemDetails.html @@ -44,17 +44,17 @@

Scenes

-
+

Special Features

-

I'm the collapsible content. By default I'm closed, but you can click the header to open me.

+
-
+

Trailers

-

I'm the collapsible content. By default I'm closed, but you can click the header to open me.

+
-
+

Cast & Crew

-

I'm the collapsible content. By default I'm closed, but you can click the header to open me.

+

Gallery

diff --git a/dashboard-ui/scripts/ItemDetailPage.js b/dashboard-ui/scripts/ItemDetailPage.js index 03ad3182c5..3478a15513 100644 --- a/dashboard-ui/scripts/ItemDetailPage.js +++ b/dashboard-ui/scripts/ItemDetailPage.js @@ -41,7 +41,6 @@ ItemDetailPage.renderImage(item); ItemDetailPage.renderOverviewBlock(item); ItemDetailPage.renderMediaInfo(item); - ItemDetailPage.renderGallery(item); if (!item.Chapters || !item.Chapters.length) { @@ -49,6 +48,16 @@ }else { ItemDetailPage.renderScenes(item); } + if (!item.LocalTrailerCount || item.LocalTrailerCount == 0) { + $('#trailersCollapsible', page).remove(); + }else { + ItemDetailPage.renderTrailers(item); + } + if (!item.SpecialFeatureCount || item.SpecialFeatureCount == 0) { + $('#specialsCollapsible', page).remove(); + }else { + ItemDetailPage.renderSpecials(item); + } $('#itemName', page).html(name); @@ -409,6 +418,137 @@ } $('#mediaInfoCollapsible', page).show(); + }, + + playTrailer: function (index) { + ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), ItemDetailPage.item.Id).done(function (trailers) { + MediaPlayer.play([trailers[index]]); + }); + }, + + onTrailersExpand: function() { + + if (ItemDetailPage.item) { + + ItemDetailPage.renderTrailers(ItemDetailPage.item); + + $(this).off('expand', ItemDetailPage.onTrailersExpand); + } + }, + + renderTrailers: function (item) { + + var html = ''; + var page = $.mobile.activePage; + + ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), item.Id).done(function (trailers) { + + for (var i = 0, length = trailers.length; i < length; i++) { + + var trailer = trailers[i]; + + html += ''; + } + + $('#trailersContent', page).html(html); + + }); + + }, + + playSpecial: function (index) { + ApiClient.getSpecialFeatures(Dashboard.getCurrentUserId(), ItemDetailPage.item.Id).done(function (specials) { + MediaPlayer.play([specials[index]]); + }); + }, + + onSpecialsExpand: function() { + + if (ItemDetailPage.item) { + + ItemDetailPage.renderSpecials(ItemDetailPage.item); + + $(this).off('expand', ItemDetailPage.onSpecialsExpand); + } + }, + + renderSpecials: function (item) { + + var html = ''; + var page = $.mobile.activePage; + + ApiClient.getSpecialFeatures(Dashboard.getCurrentUserId(), item.Id).done(function (specials) { + + for (var i = 0, length = specials.length; i < length; i++) { + + var special = specials[i]; + + html += ''; + } + + $('#specialsContent', page).html(html); + + }); } };