diff --git a/dashboard-ui/css/librarybrowser.css b/dashboard-ui/css/librarybrowser.css index 96032e4e6c..44f4ca0179 100644 --- a/dashboard-ui/css/librarybrowser.css +++ b/dashboard-ui/css/librarybrowser.css @@ -1267,6 +1267,12 @@ a.itemTag:hover { border: 0; } + .itemsListview .playedIndicator { + right: 1em; + top: 55%; + background: rgba(82, 181, 75, .8); + } + .listviewImage { width: 80px; height: 80px; diff --git a/dashboard-ui/games.html b/dashboard-ui/games.html index 0b3c68faed..d672a8b0c5 100644 --- a/dashboard-ui/games.html +++ b/dashboard-ui/games.html @@ -16,6 +16,12 @@
+
+ +
diff --git a/dashboard-ui/musicalbumartists.html b/dashboard-ui/musicalbumartists.html index b9ff13d8da..ec7776bc6e 100644 --- a/dashboard-ui/musicalbumartists.html +++ b/dashboard-ui/musicalbumartists.html @@ -19,6 +19,12 @@
+
+ +
diff --git a/dashboard-ui/musicartists.html b/dashboard-ui/musicartists.html index 6099d30f72..daff43837e 100644 --- a/dashboard-ui/musicartists.html +++ b/dashboard-ui/musicartists.html @@ -19,6 +19,12 @@
+
+ +
diff --git a/dashboard-ui/scripts/gamespage.js b/dashboard-ui/scripts/gamespage.js index f345b4e299..c426c709b2 100644 --- a/dashboard-ui/scripts/gamespage.js +++ b/dashboard-ui/scripts/gamespage.js @@ -1,6 +1,8 @@ (function ($, document) { + var view = LibraryBrowser.getDefaultItemsView('Poster', 'List'); + // The base query options var query = { @@ -8,7 +10,7 @@ SortOrder: "Ascending", MediaTypes: "Game", Recursive: true, - Fields: "Genres,Studios,PrimaryImageAspectRatio", + Fields: "Genres,Studios,PrimaryImageAspectRatio,SortName", StartIndex: 0 }; @@ -32,14 +34,25 @@ updateFilterControls(page); - html = LibraryBrowser.getPosterViewHtml({ - items: result.Items, - shape: "auto", - context: 'games', - showTitle: true, - showParentTitle: true, - centerText: true - }); + if (view == "List") { + + html = LibraryBrowser.getListViewHtml({ + items: result.Items, + context: 'games', + sortBy: query.SortBy + }); + $('.itemsContainer', page).removeClass('timelineItemsContainer'); + } + else if (view == "Poster") { + html = LibraryBrowser.getPosterViewHtml({ + items: result.Items, + shape: "auto", + context: 'games', + showTitle: true, + showParentTitle: true, + centerText: true + }); + } html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount); @@ -104,6 +117,8 @@ }).checkboxradio('refresh'); + $('#selectView', page).val(view).selectmenu('refresh'); + $('#chkTrailer', page).checked(query.HasTrailer == true).checkboxradio('refresh'); $('#chkThemeSong', page).checked(query.HasThemeSong == true).checkboxradio('refresh'); $('#chkThemeVideo', page).checked(query.HasThemeVideo == true).checkboxradio('refresh'); @@ -193,8 +208,27 @@ reloadItems(page); }); + $('#selectView', this).on('change', function () { + + view = this.value; + + if (view == "Timeline") { + + query.SortBy = "PremiereDate"; + query.SortOrder = "Descending"; + query.StartIndex = 0; + $('#radioPremiereDate', page)[0].click(); + + } else { + reloadItems(page); + } + + LibraryBrowser.saveViewSetting(getSavedQueryKey(), view); + }); + }).on('pagebeforeshow', "#gamesPage", function () { + var page = this; query.ParentId = LibraryMenu.getTopParentId(); var limit = LibraryBrowser.getDefaultPageSize(); @@ -205,9 +239,18 @@ query.StartIndex = 0; } - LibraryBrowser.loadSavedQueryValues(getSavedQueryKey(), query); + var viewkey = getSavedQueryKey(); - reloadItems(this); + LibraryBrowser.loadSavedQueryValues(viewkey, query); + + LibraryBrowser.getSavedViewSetting(viewkey).done(function (val) { + + if (val) { + $('#selectView', page).val(val).selectmenu('refresh').trigger('change'); + } else { + reloadItems(page); + } + }); }).on('pageshow', "#gamesPage", function () { diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 834276be96..216f4d9a8d 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -498,21 +498,24 @@ return ApiClient.getScaledImageUrl(item.Id || item.ItemId, options); }, - - getListViewIndex: function(item, sortBy) { + + getListViewIndex: function (item, sortBy) { sortBy = (sortBy || '').toLowerCase(); - + var code, name; + if (sortBy.indexOf('sortname') == 0) { if (item.Type == 'Episode') return ''; - + // SortName - var name = (item.SortName || item.Name)[0]; - - if (!isNaN(name)) { + name = (item.SortName || item.Name)[0].toUpperCase(); + + code = name.charCodeAt(0); + if (code < 65 || code > 90) { return '#'; } + return name.toUpperCase(); } if (sortBy.indexOf('officialrating') == 0) { @@ -547,13 +550,15 @@ // SortName if (!item.AlbumArtist) return ''; - - var albumartist = item.AlbumArtist[0]; - if (!isNaN(albumartist)) { + name = item.AlbumArtist[0].toUpperCase(); + + code = name.charCodeAt(0); + if (code < 65 || code > 90) { return '#'; } - return albumartist.toUpperCase(); + + return name.toUpperCase(); } return ''; }, @@ -572,7 +577,7 @@ var html = ''; var itemGroupTitle = LibraryBrowser.getListViewIndex(item, options.sortBy); - + if (itemGroupTitle != groupTitle) { html += '
  • '; @@ -590,7 +595,7 @@ if (item.ImageTags.Primary) { // Scaling 400w episode images to 80 doesn't turn out very well - var width = item.Type == 'Episode' ? 160 : 80; + var width = item.Type == 'Episode' || item.Type == 'Game' ? 160 : 80; imgUrl = ApiClient.getScaledImageUrl(item.Id, { width: width, @@ -609,24 +614,62 @@ } } + var textlines = []; + + if (item.Type == 'Episode') { + textlines.push(item.SeriesName || 'Unknown Series'); + } + else if (item.Type == 'MusicAlbum') { + textlines.push(item.AlbumArtist || 'Unknown Artist'); + } + + textlines.push(LibraryBrowser.getPosterViewDisplayName(item)); + + if (item.Type == 'Game') { + textlines.push(item.GameSystem || 'Unknown Gane System'); + } + + textlines.push(LibraryBrowser.getMiscInfoHtml(item)); + html += '

    '; - html += LibraryBrowser.getPosterViewDisplayName(item); + html += textlines[0]; html += '

    '; - html += '

    '; - html += LibraryBrowser.getMiscInfoHtml(item); - html += '

    '; + if (textlines.length > 1) { + html += '

    '; + html += textlines[1]; + html += '

    '; + } html += '
    '; - html += LibraryBrowser.getRatingHtml(item, false); + html += textlines[2] || LibraryBrowser.getRatingHtml(item, false); html += '
    '; - if (item.UserData.UnplayedItemCount) { - html += '' + item.UserData.UnplayedItemCount + ''; + if (item.Type == 'Series' || item.Type == 'Season' || item.Type == 'BoxSet' || item.MediaType == 'Video') { + if (item.UserData.UnplayedItemCount) { + html += '' + item.UserData.UnplayedItemCount + ''; + } + else if (item.UserData.Played) { + html += '
    '; + } } html += ''; - html += ''; + var itemCommands = []; + + //if (MediaController.canPlay(item)) { + // itemCommands.push('playmenu'); + //} + + if (item.Type != "Recording" && item.Type != "Program") { + itemCommands.push('edit'); + } + + if (item.LocalTrailerCount) { + itemCommands.push('trailer'); + } + + html += ''; html += ''; html += '
  • '; diff --git a/dashboard-ui/scripts/librarylist.js b/dashboard-ui/scripts/librarylist.js index c988ddc2b8..78bd76a6ec 100644 --- a/dashboard-ui/scripts/librarylist.js +++ b/dashboard-ui/scripts/librarylist.js @@ -212,9 +212,15 @@ function onPosterItemTapHold(e) { - $('.tapHoldMenu').popup("close").remove(); + showContextMenu(this); - var posterItem = this; + e.preventDefault(); + return false; + } + + function showContextMenu(posterItem) { + + $('.tapHoldMenu').popup("close").remove(); var itemId = posterItem.getAttribute('data-itemid'); var commands = posterItem.getAttribute('data-commands').split(','); @@ -234,8 +240,10 @@ html += '
      '; html += '
    • ' + Globalize.translate('HeaderMenu') + '
    • '; - html += '
    • ' + Globalize.translate('ButtonOpen') + '
    • '; - html += '
    • ' + Globalize.translate('ButtonOpenInNewTab') + '
    • '; + var href = posterItem.getAttribute('data-href') || posterItem.href; + + html += '
    • ' + Globalize.translate('ButtonOpen') + '
    • '; + html += '
    • ' + Globalize.translate('ButtonOpenInNewTab') + '
    • '; if (user.Configuration.IsAdministrator && commands.indexOf('edit') != -1) { html += '
    • ' + Globalize.translate('ButtonEdit') + '
    • '; @@ -285,6 +293,11 @@ $('.btnShuffle', elem).on('click', onShuffleButtonClick); $('.btnPlayTrailer', elem).on('click', onTrailerButtonClick); }); + } + + function onListViewMenuButtonClick(e) { + + showContextMenu(this); e.preventDefault(); return false; @@ -471,6 +484,8 @@ $('.posterItem', this).on('contextmenu.posterItemMenu', onPosterItemTapHold); + $('.listviewMenuButton', this).on('click', onListViewMenuButtonClick); + $('.groupedPosterItem', this).on('click', onGroupedPosterItemClick); return this.off('.posterItemHoverMenu') diff --git a/dashboard-ui/scripts/musicalbumartists.js b/dashboard-ui/scripts/musicalbumartists.js index bfaf5db0aa..438af24f32 100644 --- a/dashboard-ui/scripts/musicalbumartists.js +++ b/dashboard-ui/scripts/musicalbumartists.js @@ -1,12 +1,14 @@ (function ($, document) { + var view = LibraryBrowser.getDefaultItemsView('Poster', 'List'); + // The base query options var query = { SortBy: "SortName", SortOrder: "Ascending", Recursive: true, - Fields: "DateCreated", + Fields: "PrimaryImageAspectRatio,SortName,DateCreated", StartIndex: 0 }; @@ -30,15 +32,25 @@ updateFilterControls(page); - html = LibraryBrowser.getPosterViewHtml({ - items: result.Items, - shape: "square", - context: 'music', - showTitle: true, - coverImage: true, - centerText: true, - lazy: true - }); + if (view == "List") { + + html = LibraryBrowser.getListViewHtml({ + items: result.Items, + context: 'music', + sortBy: query.SortBy + }); + } + else if (view == "Poster") { + html = LibraryBrowser.getPosterViewHtml({ + items: result.Items, + shape: "square", + context: 'music', + showTitle: true, + coverImage: true, + centerText: true, + lazy: true + }); + } html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount); @@ -77,6 +89,8 @@ }).checkboxradio('refresh'); + $('#selectView', page).val(view).selectmenu('refresh'); + $('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater); } @@ -115,8 +129,18 @@ reloadItems(page); }); + $('#selectView', this).on('change', function () { + + view = this.value; + + reloadItems(page); + + LibraryBrowser.saveViewSetting(getSavedQueryKey(), view); + }); + }).on('pagebeforeshow', "#musicAlbumArtistsPage", function () { + var page = this; query.ParentId = LibraryMenu.getTopParentId(); var limit = LibraryBrowser.getDefaultPageSize(); @@ -127,9 +151,18 @@ query.StartIndex = 0; } - LibraryBrowser.loadSavedQueryValues(getSavedQueryKey(), query); + var viewkey = getSavedQueryKey(); - reloadItems(this); + LibraryBrowser.loadSavedQueryValues(viewkey, query); + + LibraryBrowser.getSavedViewSetting(viewkey).done(function (val) { + + if (val) { + $('#selectView', page).val(val).selectmenu('refresh').trigger('change'); + } else { + reloadItems(page); + } + }); }).on('pageshow', "#musicAlbumArtistsPage", function () { diff --git a/dashboard-ui/scripts/musicartists.js b/dashboard-ui/scripts/musicartists.js index 6bcc59a1f0..ab8e846680 100644 --- a/dashboard-ui/scripts/musicartists.js +++ b/dashboard-ui/scripts/musicartists.js @@ -1,12 +1,14 @@ (function ($, document) { + var view = LibraryBrowser.getDefaultItemsView('Poster', 'List'); + // The base query options var query = { SortBy: "SortName", SortOrder: "Ascending", Recursive: true, - Fields: "DateCreated", + Fields: "PrimaryImageAspectRatio,SortName,DateCreated", StartIndex: 0 }; @@ -30,15 +32,25 @@ updateFilterControls(page); - html = LibraryBrowser.getPosterViewHtml({ - items: result.Items, - shape: "square", - context: 'music', - showTitle: true, - coverImage: true, - centerText: true, - lazy: true - }); + if (view == "List") { + + html = LibraryBrowser.getListViewHtml({ + items: result.Items, + context: 'music', + sortBy: query.SortBy + }); + } + else if (view == "Poster") { + html = LibraryBrowser.getPosterViewHtml({ + items: result.Items, + shape: "square", + context: 'music', + showTitle: true, + coverImage: true, + centerText: true, + lazy: true + }); + } html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount); @@ -77,6 +89,8 @@ }).checkboxradio('refresh'); + $('#selectView', page).val(view).selectmenu('refresh'); + $('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater); } @@ -115,8 +129,19 @@ reloadItems(page); }); + $('#selectView', this).on('change', function () { + + view = this.value; + + reloadItems(page); + + LibraryBrowser.saveViewSetting(getSavedQueryKey(), view); + }); + }).on('pagebeforeshow', "#musicArtistsPage", function () { + var page = this; + query.ParentId = LibraryMenu.getTopParentId(); var limit = LibraryBrowser.getDefaultPageSize(); @@ -127,9 +152,18 @@ query.StartIndex = 0; } - LibraryBrowser.loadSavedQueryValues(getSavedQueryKey(), query); + var viewkey = getSavedQueryKey(); - reloadItems(this); + LibraryBrowser.loadSavedQueryValues(viewkey, query); + + LibraryBrowser.getSavedViewSetting(viewkey).done(function (val) { + + if (val) { + $('#selectView', page).val(val).selectmenu('refresh').trigger('change'); + } else { + reloadItems(page); + } + }); }).on('pageshow', "#musicArtistsPage", function () {