From 7e2ffe8202977cd169dacebbf008b35b2a6e0ac9 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 15 Mar 2014 18:52:43 -0400 Subject: [PATCH] #712 - Support grouping multiple versions of a movie --- dashboard-ui/itemdetails.html | 6 ++++ dashboard-ui/scripts/itemdetailpage.js | 44 ++++++++++++++++++++++++-- dashboard-ui/scripts/librarybrowser.js | 20 ++++++------ 3 files changed, 57 insertions(+), 13 deletions(-) diff --git a/dashboard-ui/itemdetails.html b/dashboard-ui/itemdetails.html index b5c03b0dd3..c73c25b972 100644 --- a/dashboard-ui/itemdetails.html +++ b/dashboard-ui/itemdetails.html @@ -175,6 +175,12 @@
+
+
+ Alternate Versions +
+
+
Additional Parts diff --git a/dashboard-ui/scripts/itemdetailpage.js b/dashboard-ui/scripts/itemdetailpage.js index 3aa1ec43a2..4dd64c5fc4 100644 --- a/dashboard-ui/scripts/itemdetailpage.js +++ b/dashboard-ui/scripts/itemdetailpage.js @@ -227,6 +227,13 @@ renderAdditionalParts(page, item, user); } + if (!item.HasAlternateVersions) { + $('#alternateVersionsCollapsible', page).addClass('hide'); + } else { + $('#alternateVersionsCollapsible', page).removeClass('hide'); + renderAlternateVersions(page, item, user); + } + $('#themeSongsCollapsible', page).hide(); $('#themeVideosCollapsible', page).hide(); @@ -665,7 +672,7 @@ var otherTypeItems = items.filter(function (curr) { - return !types.filter(function(t) { + return !types.filter(function (t) { return t.type == curr.Type; @@ -676,9 +683,9 @@ if (otherTypeItems.length) { renderCollectionItemType(page, otherType, otherTypeItems, user); } - + if (!items.length) { - renderCollectionItemType(page, {name: 'Titles'}, items, user); + renderCollectionItemType(page, { name: 'Titles' }, items, user); } $('.collectionItems', page).trigger('create').createPosterItemHoverMenu(); @@ -886,6 +893,37 @@ }); } + function renderAlternateVersions(page, item, user) { + + var url = ApiClient.getUrl("Videos/" + item.Id + "/AlternateVersions", { + userId: user.Id + }); + + $.getJSON(url).done(function (result) { + + if (result.Items.length) { + + $('#alternateVersionsCollapsible', page).show(); + + $('#additionalPartsCollapsible', page).show(); + + var html = LibraryBrowser.getPosterViewHtml({ + items: result.Items, + shape: "portrait", + context: 'movies', + useAverageAspectRatio: true, + showTitle: true, + centerText: true, + formatIndicators: true + }); + + $('#alternateVersionsContent', page).html(html).trigger('create').createPosterItemHoverMenu(); + } else { + $('#alternateVersionsCollapsible', page).hide(); + } + }); + } + function renderScenes(page, item, user, limit) { var html = ''; diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 76eda9e4a0..90227fcd2a 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -665,7 +665,7 @@ html += ''; // Ribbon - if (item.MediaType == "Video" && item.Video3DFormat) { + if (item.MediaType == "Video" && options.formatIndicators) { // This would be much better if specified in the json payload // Another nice thing to have in the payload would be 720 vs 1080 // Then, rather than "HD" it could display the specific HD format @@ -2186,18 +2186,18 @@ var sequence = this; - Dashboard.getCurrentUser().done(function (user) { + //Dashboard.getCurrentUser().done(function (user) { - if (user.Configuration.IsAdministrator) { + // if (user.Configuration.IsAdministrator) { - sequence.createContextMenu({ - getOptions: getMenuOptions, - command: onMenuCommand, - selector: '.posterItem' - }); - } + // sequence.createContextMenu({ + // getOptions: getMenuOptions, + // command: onMenuCommand, + // selector: '.posterItem' + // }); + // } - }); + //}); return this.on('mouseenter', '.backdropPosterItem,.smallBackdropPosterItem,.portraitPosterItem,.squarePosterItem', onHoverIn) .on('mouseleave', '.backdropPosterItem,.smallBackdropPosterItem,.portraitPosterItem,.squarePosterItem', onHoverOut);