From 1a1721b4eea2349e075a683973f8cab7deca64f7 Mon Sep 17 00:00:00 2001 From: Qstick Date: Sat, 19 Aug 2017 21:03:09 -0400 Subject: [PATCH] Fixes misc issues on Artist Detail Page (#57) Get MB link working, bring in album-type from db instead of hard code, sort albums by release date, fix quirk with track number sorting, rename tool-tips --- src/NzbDrone.Api/Albums/AlbumResource.cs | 3 +++ src/UI/Artist/AlbumCollection.js | 17 ++++++++++++++++- src/UI/Artist/Details/AlbumLayout.js | 2 +- src/UI/Artist/Details/AlbumLayoutTemplate.hbs | 2 +- src/UI/Artist/Details/ArtistDetailsTemplate.hbs | 8 ++++---- src/UI/Artist/TrackCollection.js | 2 +- src/UI/Handlebars/Helpers/Artist.js | 2 +- 7 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/NzbDrone.Api/Albums/AlbumResource.cs b/src/NzbDrone.Api/Albums/AlbumResource.cs index 9c6f5487e..a283deebf 100644 --- a/src/NzbDrone.Api/Albums/AlbumResource.cs +++ b/src/NzbDrone.Api/Albums/AlbumResource.cs @@ -19,6 +19,7 @@ namespace NzbDrone.Api.Albums public string Path { get; set; } public int ProfileId { get; set; } public int Duration { get; set; } + public string AlbumType { get; set; } public Ratings Ratings { get; set; } public DateTime? ReleaseDate { get; set; } public List Genres { get; set; } @@ -48,6 +49,7 @@ namespace NzbDrone.Api.Albums Images = model.Images, Ratings = model.Ratings, Duration = model.Duration, + AlbumType = model.AlbumType }; } @@ -68,6 +70,7 @@ namespace NzbDrone.Api.Albums Title = resource.Title, Images = resource.Images, Ratings = resource.Ratings, + AlbumType = resource.AlbumType }; } diff --git a/src/UI/Artist/AlbumCollection.js b/src/UI/Artist/AlbumCollection.js index c129665c0..ac89d58cf 100644 --- a/src/UI/Artist/AlbumCollection.js +++ b/src/UI/Artist/AlbumCollection.js @@ -2,7 +2,7 @@ var Backbone = require('backbone'); var AlbumModel = require('./AlbumModel'); module.exports = Backbone.Collection.extend({ - url : window.NzbDrone.ApiRoot + '/album', + url : window.NzbDrone.ApiRoot + '/album', model : AlbumModel, originalFetch : Backbone.Collection.prototype.fetch, @@ -12,6 +12,21 @@ module.exports = Backbone.Collection.extend({ this.models = []; }, + comparator : function(model1, model2) { + var album1 = model1.get('releaseDate'); + var album2 = model2.get('releaseDate'); + + if (album1 > album2) { + return -1; + } + + if (album1 < album2) { + return 1; + } + + return 0; + }, + fetch : function(options) { if (!this.artistId) { throw 'artistId is required'; diff --git a/src/UI/Artist/Details/AlbumLayout.js b/src/UI/Artist/Details/AlbumLayout.js index 2b0b99a1b..d1870d95e 100644 --- a/src/UI/Artist/Details/AlbumLayout.js +++ b/src/UI/Artist/Details/AlbumLayout.js @@ -99,7 +99,7 @@ module.exports = Marionette.Layout.extend({ label : 'Status', cell : TrackStatusCell, sortable : false - }, + } //{ // name : 'this', // label : '', diff --git a/src/UI/Artist/Details/AlbumLayoutTemplate.hbs b/src/UI/Artist/Details/AlbumLayoutTemplate.hbs index f0d15eedb..6cd18d5d6 100644 --- a/src/UI/Artist/Details/AlbumLayoutTemplate.hbs +++ b/src/UI/Artist/Details/AlbumLayoutTemplate.hbs @@ -47,7 +47,7 @@ Release Date: {{albumReleaseDate}}
- Type: Album + Type: {{albumType}}
diff --git a/src/UI/Artist/Details/ArtistDetailsTemplate.hbs b/src/UI/Artist/Details/ArtistDetailsTemplate.hbs index ffa9a0716..2e72f1127 100644 --- a/src/UI/Artist/Details/ArtistDetailsTemplate.hbs +++ b/src/UI/Artist/Details/ArtistDetailsTemplate.hbs @@ -8,17 +8,17 @@ {{name}}
-
- +
+
- +
diff --git a/src/UI/Artist/TrackCollection.js b/src/UI/Artist/TrackCollection.js index 6da0f0c53..502827325 100644 --- a/src/UI/Artist/TrackCollection.js +++ b/src/UI/Artist/TrackCollection.js @@ -9,7 +9,7 @@ module.exports = PageableCollection.extend({ state : { sortKey : 'trackNumber', - order : 1, + order : -1, pageSize : 100000 }, diff --git a/src/UI/Handlebars/Helpers/Artist.js b/src/UI/Handlebars/Helpers/Artist.js index 745b17c76..4840d9467 100644 --- a/src/UI/Handlebars/Helpers/Artist.js +++ b/src/UI/Handlebars/Helpers/Artist.js @@ -22,7 +22,7 @@ Handlebars.registerHelper('poster', function() { Handlebars.registerHelper('MBUrl', function() { - return 'https://musicbrainz.org/artist/' + this.mbId; + return 'https://musicbrainz.org/artist/' + this.foreignArtistId; }); Handlebars.registerHelper('TADBUrl', function() {