diff --git a/dashboard-ui/scripts/Itemdetailpage.js b/dashboard-ui/scripts/Itemdetailpage.js index 187b43ae71..df5027f233 100644 --- a/dashboard-ui/scripts/Itemdetailpage.js +++ b/dashboard-ui/scripts/Itemdetailpage.js @@ -8,6 +8,7 @@ $('#scenesCollapsible', this).on('expand', ItemDetailPage.onScenesExpand); $('#specialsCollapsible', this).on('expand', ItemDetailPage.onSpecialsExpand); $('#trailersCollapsible', this).on('expand', ItemDetailPage.onTrailersExpand); + $('#castCollapsible', this).on('expand', ItemDetailPage.onCastExpand); $('#galleryCollapsible', this).on('expand', ItemDetailPage.onGalleryExpand); }, @@ -17,6 +18,7 @@ $('#scenesCollapsible', this).off('expand', ItemDetailPage.onScenesExpand); $('#specialsCollapsible', this).off('expand', ItemDetailPage.onSpecialsExpand); $('#trailersCollapsible', this).off('expand', ItemDetailPage.onTrailersExpand); + $('#castCollapsible', this).off('expand', ItemDetailPage.onCastExpand); $('#galleryCollapsible', this).off('expand', ItemDetailPage.onGalleryExpand); ItemDetailPage.item = null; @@ -73,6 +75,11 @@ } else { $('#specialsCollapsible', page).show(); } + if (!item.People || !item.People.length) { + $('#castCollapsible', page).hide(); + } else { + $('#castCollapsible', page).show(); + } $('#itemName', page).html(name); @@ -484,7 +491,8 @@ html += '' + stream.BitRate +''; if (stream.Type == "Video") { - html += ''+ stream.AverageFrameRate || stream.RealFrameRate +''; + var framerate = stream.AverageFrameRate || stream.RealFrameRate; + html += ''+ framerate +''; }else if (stream.Type == "Audio") { var notes = new Array(); if (stream.IsDefault) notes.push("Default"); @@ -622,7 +630,6 @@ html += ''; } - html += '
' + special.Name + '
'; html += '
'; @@ -642,6 +649,52 @@ $('#specialsContent', page).html(html); }); + }, + + onCastExpand: function () { + + if (ItemDetailPage.item) { + + ItemDetailPage.renderCast(ItemDetailPage.item); + + $(this).off('expand', ItemDetailPage.onCastExpand); + } + }, + + renderCast: function (item) { + + var html = ''; + var page = $.mobile.activePage; + var casts = item.People || {}; + + for (var i = 0, length = casts.length; i < length; i++) { + + var cast = casts[i]; + var role = cast.Role || cast.Type; + + html += '
'; + + if (cast.PrimaryImageTag) { + + var imgUrl = ApiClient.getPersonImageUrl(cast.Name, { + maxwidth: 185, + tag: cast.PrimaryImageTag, + type: "primary" + }); + + html += ''; + } else { + html += ''; + } + + html += '
' + cast.Name + '
'; + html += '
' + role + '
'; + + html += '
'; + + } + + $('#castContent', page).html(html); } };