From b9c29ad110b13f8131027b62ba757f362bddcaf2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 10 Apr 2013 00:38:04 -0400 Subject: [PATCH 1/2] added new indicators --- dashboard-ui/css/librarybrowser.css | 10 ++++++ dashboard-ui/css/site.css | 2 +- dashboard-ui/scripts/boxsets.js | 2 +- dashboard-ui/scripts/librarybrowser.js | 40 ++++++++++++++++++++--- dashboard-ui/scripts/movies.js | 2 +- dashboard-ui/scripts/moviesrecommended.js | 5 +-- dashboard-ui/scripts/tvrecommended.js | 5 +-- dashboard-ui/scripts/tvshows.js | 2 +- 8 files changed, 55 insertions(+), 13 deletions(-) diff --git a/dashboard-ui/css/librarybrowser.css b/dashboard-ui/css/librarybrowser.css index 40598357fb..19e8f778a7 100644 --- a/dashboard-ui/css/librarybrowser.css +++ b/dashboard-ui/css/librarybrowser.css @@ -175,3 +175,13 @@ .mediaInfoLabel { color: #bbb; } + +.posterRibbon { + display: block; + position: absolute; + top: 0; + right: 0; + text-align: center; + background-color: #008FBB; + padding: 2px 10px; +} diff --git a/dashboard-ui/css/site.css b/dashboard-ui/css/site.css index a81cd7085f..8d28c42a8a 100644 --- a/dashboard-ui/css/site.css +++ b/dashboard-ui/css/site.css @@ -407,7 +407,7 @@ form, .readOnlyContent { display: inline-block; margin: 5px; text-align: center; - font-size: 15px; + font-size: 14px; padding: 0; position: relative; padding-bottom: 28px; diff --git a/dashboard-ui/scripts/boxsets.js b/dashboard-ui/scripts/boxsets.js index 28ab752e3a..adbc6bd726 100644 --- a/dashboard-ui/scripts/boxsets.js +++ b/dashboard-ui/scripts/boxsets.js @@ -7,7 +7,7 @@ SortOrder: "Ascending", IncludeItemTypes: "BoxSet", Recursive: true, - Fields: "PrimaryImageAspectRatio,ItemCounts" + Fields: "PrimaryImageAspectRatio,ItemCounts,ItemCounts,DateCreated" }; diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 7a82a8732d..a8cd2afae4 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -1,13 +1,13 @@ var LibraryBrowser = { - getDetaultPageSize: function() { + getDetaultPageSize: function () { if (window.location.toString().toLowerCase().indexOf('localhost') != -1) { return 100; } return 25; }, - + getPosterViewHtml: function (options) { var items = options.items; @@ -35,7 +35,7 @@ height: 198, width: 352, tag: item.BackdropImageTags[0] - + }) + "' />"; } else if (hasPrimaryImage) { @@ -47,7 +47,7 @@ height: height, width: width, tag: item.ImageTags.Primary - + }) + "' />"; } else if (item.BackdropImageTags && item.BackdropImageTags.length) { @@ -56,7 +56,7 @@ height: 198, width: 352, tag: item.BackdropImageTags[0] - + }) + "' />"; } else if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist") { @@ -78,6 +78,10 @@ html += ""; } + if (options.showNewIndicator !== false) { + html += LibraryBrowser.getNewIndicatorHtml(item); + } + html += ""; } @@ -153,6 +157,10 @@ html += ""; } + if (options.showNewIndicator !== false) { + html += LibraryBrowser.getNewIndicatorHtml(item); + } + html += ""; } @@ -220,12 +228,34 @@ html += ""; } + if (options.showNewIndicator !== false) { + html += LibraryBrowser.getNewIndicatorHtml(item); + } + html += ""; } return html; }, + getNewIndicatorHtml: function (item) { + + if (item.RecentlyAddedItemCount) { + return '
' + item.RecentlyAddedItemCount + ' New
'; + } + + if (!item.IsFolder) { + + var date = item.DateCreated; + + if (date && (new Date().getTime() - parseISO8601Date(date).getTime()) < 1209600000) { + return "
New
"; + } + } + + return ''; + }, + getAveragePrimaryImageAspectRatio: function (items) { var values = []; diff --git a/dashboard-ui/scripts/movies.js b/dashboard-ui/scripts/movies.js index 5bb0d8913a..90fb4cec2f 100644 --- a/dashboard-ui/scripts/movies.js +++ b/dashboard-ui/scripts/movies.js @@ -9,7 +9,7 @@ SortOrder: "Ascending", IncludeItemTypes: "Movie", Recursive: true, - Fields: "PrimaryImageAspectRatio,UserData,DisplayMediaType", + Fields: "PrimaryImageAspectRatio,UserData,DisplayMediaType,ItemCounts,DateCreated", Limit: LibraryBrowser.getDetaultPageSize(), StartIndex: 0 }; diff --git a/dashboard-ui/scripts/moviesrecommended.js b/dashboard-ui/scripts/moviesrecommended.js index 0c894c621c..e53102a83f 100644 --- a/dashboard-ui/scripts/moviesrecommended.js +++ b/dashboard-ui/scripts/moviesrecommended.js @@ -19,7 +19,8 @@ $('#recentlyAddedItems', page).html(LibraryBrowser.getPosterViewHtml({ items: result.Items, - useAverageAspectRatio: true + useAverageAspectRatio: true, + showNewIndicator: false })); }); @@ -59,7 +60,7 @@ IncludeItemTypes: "Trailer", Limit: 5, Recursive: true, - Fields: "PrimaryImageAspectRatio", + Fields: "PrimaryImageAspectRatio,DateCreated", Filters: "IsUnplayed" }; diff --git a/dashboard-ui/scripts/tvrecommended.js b/dashboard-ui/scripts/tvrecommended.js index 31a583b0e8..58aa760832 100644 --- a/dashboard-ui/scripts/tvrecommended.js +++ b/dashboard-ui/scripts/tvrecommended.js @@ -19,7 +19,8 @@ $('#recentlyAddedItems', page).html(LibraryBrowser.getEpisodePosterViewHtml({ items: result.Items, - useAverageAspectRatio: true + useAverageAspectRatio: true, + showNewIndicator: false })); }); @@ -33,7 +34,7 @@ Filters: "IsResumable", Limit: 6, Recursive: true, - Fields: "PrimaryImageAspectRatio,SeriesInfo" + Fields: "PrimaryImageAspectRatio,SeriesInfo,DateCreated" }; ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) { diff --git a/dashboard-ui/scripts/tvshows.js b/dashboard-ui/scripts/tvshows.js index dd9f8b2c42..ad4ba61be3 100644 --- a/dashboard-ui/scripts/tvshows.js +++ b/dashboard-ui/scripts/tvshows.js @@ -7,7 +7,7 @@ SortOrder: "Ascending", IncludeItemTypes: "Series", Recursive: true, - Fields: "PrimaryImageAspectRatio,SeriesInfo" + Fields: "PrimaryImageAspectRatio,SeriesInfo,ItemCounts,DateCreated" }; function getTableHtml(items) { From 3016dbcdc684909db250c21c350da53798495119 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 10 Apr 2013 00:49:36 -0400 Subject: [PATCH 2/2] rounding on new indicator --- dashboard-ui/css/librarybrowser.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dashboard-ui/css/librarybrowser.css b/dashboard-ui/css/librarybrowser.css index 19e8f778a7..b4b403e651 100644 --- a/dashboard-ui/css/librarybrowser.css +++ b/dashboard-ui/css/librarybrowser.css @@ -183,5 +183,6 @@ right: 0; text-align: center; background-color: #008FBB; - padding: 2px 10px; + padding: 3px 10px; + border-bottom-left-radius: 10px; }