From 1dfb4ddcd816750bd03819ab0b734d90af89b16e Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Sun, 8 Jan 2017 17:10:56 +0100 Subject: [PATCH 1/2] Fixes sorting of movies. Fixes #53. --- src/UI/Activity/History/HistoryCollection.js | 2 +- src/UI/Movies/Index/MoviesIndexLayout.js | 38 +------------------ src/UI/Movies/MoviesCollection.js | 8 ++-- .../Toolbar/Sorting/SortingButtonView.js | 2 +- 4 files changed, 8 insertions(+), 42 deletions(-) diff --git a/src/UI/Activity/History/HistoryCollection.js b/src/UI/Activity/History/HistoryCollection.js index 5eb4dc4f7..8c82b7988 100644 --- a/src/UI/Activity/History/HistoryCollection.js +++ b/src/UI/Activity/History/HistoryCollection.js @@ -50,7 +50,7 @@ var Collection = PageableCollection.extend({ }, sortMappings : { - 'movie' : { sortKey : 'movie.sortTitle' } + 'movie' : { sortKey : 'movie.title' } }, initialize : function(options) { diff --git a/src/UI/Movies/Index/MoviesIndexLayout.js b/src/UI/Movies/Index/MoviesIndexLayout.js index 3e16a7eb7..8e87390ba 100644 --- a/src/UI/Movies/Index/MoviesIndexLayout.js +++ b/src/UI/Movies/Index/MoviesIndexLayout.js @@ -38,7 +38,6 @@ module.exports = Marionette.Layout.extend({ label : 'Title', cell : MovieTitleCell, cellValue : 'this', - sortValue : 'sortTitle' }, { name : 'profileId', @@ -128,25 +127,13 @@ module.exports = Marionette.Layout.extend({ title : 'Title', name : 'title' }, - { - title : 'Seasons', - name : 'seasonCount' - }, { title : 'Quality', name : 'profileId' }, { - title : 'Network', - name : 'network' - }, - { - title : 'Next Airing', - name : 'nextAiring' - }, - { - title : 'Episodes', - name : 'percentOfEpisodes' + title : 'In Cinemas', + name : 'inCinemas' } ] }; @@ -170,27 +157,6 @@ module.exports = Marionette.Layout.extend({ tooltip : 'Monitored Only', icon : 'icon-sonarr-monitored', callback : this._setFilter - }, - { - key : 'continuing', - title : '', - tooltip : 'Continuing Only', - icon : 'icon-sonarr-series-continuing', - callback : this._setFilter - }, - { - key : 'ended', - title : '', - tooltip : 'Ended Only', - icon : 'icon-sonarr-series-ended', - callback : this._setFilter - }, - { - key : 'missing', - title : '', - tooltip : 'Missing', - icon : 'icon-sonarr-missing', - callback : this._setFilter } ] }; diff --git a/src/UI/Movies/MoviesCollection.js b/src/UI/Movies/MoviesCollection.js index 2df59e282..16d50298f 100644 --- a/src/UI/Movies/MoviesCollection.js +++ b/src/UI/Movies/MoviesCollection.js @@ -15,10 +15,10 @@ var Collection = PageableCollection.extend({ tableName : 'movie', state : { - sortKey : 'sortTitle', - order : -1, + sortKey : 'title', + order : 1, pageSize : 100000, - secondarySortKey : 'sortTitle', + secondarySortKey : 'title', secondarySortOrder : -1 }, @@ -73,7 +73,7 @@ var Collection = PageableCollection.extend({ sortMappings : { title : { - sortKey : 'sortTitle' + sortKey : 'title' }, nextAiring : { diff --git a/src/UI/Shared/Toolbar/Sorting/SortingButtonView.js b/src/UI/Shared/Toolbar/Sorting/SortingButtonView.js index 6f6833ed2..a2c9bc0d9 100644 --- a/src/UI/Shared/Toolbar/Sorting/SortingButtonView.js +++ b/src/UI/Shared/Toolbar/Sorting/SortingButtonView.js @@ -67,4 +67,4 @@ module.exports = Marionette.ItemView.extend({ _removeSortIcon : function() { this.ui.icon.removeClass('icon-sonarr-sort-asc icon-sonarr-sort-desc'); } -}); \ No newline at end of file +}); From 49537a2efe33a028fc0c06aca47ef74fe8885b41 Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Sun, 8 Jan 2017 17:47:19 +0100 Subject: [PATCH 2/2] Update UI to display download status. --- src/NzbDrone.Api/Series/MovieResource.cs | 8 ++++- src/UI/Cells/MovieDownloadStatusCell.js | 6 ++++ src/UI/Cells/MovieDownloadStatusTemplate.hbs | 1 + src/UI/Handlebars/Helpers/Series.js | 32 +++++++++++++++++++ src/UI/Movies/Details/InfoViewTemplate.hbs | 1 + src/UI/Movies/Index/MoviesIndexLayout.js | 10 ++++++ .../SeriesOverviewItemViewTemplate.hbs | 2 ++ 7 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 src/UI/Cells/MovieDownloadStatusCell.js create mode 100644 src/UI/Cells/MovieDownloadStatusTemplate.hbs diff --git a/src/NzbDrone.Api/Series/MovieResource.cs b/src/NzbDrone.Api/Series/MovieResource.cs index b1924629d..4038792d7 100644 --- a/src/NzbDrone.Api/Series/MovieResource.cs +++ b/src/NzbDrone.Api/Series/MovieResource.cs @@ -29,7 +29,7 @@ namespace NzbDrone.Api.Movie public DateTime? InCinemas { get; set; } public List Images { get; set; } public string Website { get; set; } - + public bool Downloaded { get; set; } public string RemotePoster { get; set; } public int Year { get; set; } @@ -79,6 +79,8 @@ namespace NzbDrone.Api.Movie { if (model == null) return null; + long Size = model.MovieFile.Value != null ? model.MovieFile.Value.Size : 0; + return new MovieResource { Id = model.Id, @@ -87,6 +89,8 @@ namespace NzbDrone.Api.Movie //AlternateTitles SortTitle = model.SortTitle, InCinemas = model.InCinemas, + + Downloaded = model.MovieFile.Value != null, //TotalEpisodeCount //EpisodeCount //EpisodeFileCount @@ -104,6 +108,8 @@ namespace NzbDrone.Api.Movie Monitored = model.Monitored, + SizeOnDisk = Size, + Runtime = model.Runtime, LastInfoSync = model.LastInfoSync, CleanTitle = model.CleanTitle, diff --git a/src/UI/Cells/MovieDownloadStatusCell.js b/src/UI/Cells/MovieDownloadStatusCell.js new file mode 100644 index 000000000..ba35657b4 --- /dev/null +++ b/src/UI/Cells/MovieDownloadStatusCell.js @@ -0,0 +1,6 @@ +var TemplatedCell = require('./TemplatedCell'); + +module.exports = TemplatedCell.extend({ + className : 'movie-title-cell', + template : 'Cells/MovieDownloadStatusTemplate', +}); diff --git a/src/UI/Cells/MovieDownloadStatusTemplate.hbs b/src/UI/Cells/MovieDownloadStatusTemplate.hbs new file mode 100644 index 000000000..002a9fdc6 --- /dev/null +++ b/src/UI/Cells/MovieDownloadStatusTemplate.hbs @@ -0,0 +1 @@ +{{DownloadedStatus}} diff --git a/src/UI/Handlebars/Helpers/Series.js b/src/UI/Handlebars/Helpers/Series.js index fbb3a23fc..41c2d641a 100644 --- a/src/UI/Handlebars/Helpers/Series.js +++ b/src/UI/Handlebars/Helpers/Series.js @@ -127,8 +127,40 @@ Handlebars.registerHelper('GetBannerStatus', function() { else if (!monitored) { return new Handlebars.SafeString('
 Not Monitored
'); } +}); + +Handlebars.registerHelper('DownloadedStatusColor', function() { + if (!this.monitored) { + if (this.downloaded) { + return "default"; + } + return "warning"; + } + + if (this.downloaded) { + return "success"; + } + + if (this.status != "released") { + return "primary"; + } + + return "danger"; }) +Handlebars.registerHelper('DownloadedStatus', function() { + + if (this.downloaded) { + return "Downloaded"; + } + if (!this.monitored) { + return "Not Monitored"; + } + + + return "Missing"; +}); + Handlebars.registerHelper('inCinemas', function() { var monthNames = ["January", "February", "March", "April", "May", "June", diff --git a/src/UI/Movies/Details/InfoViewTemplate.hbs b/src/UI/Movies/Details/InfoViewTemplate.hbs index 1897c841a..602a13e72 100644 --- a/src/UI/Movies/Details/InfoViewTemplate.hbs +++ b/src/UI/Movies/Details/InfoViewTemplate.hbs @@ -26,6 +26,7 @@ {{else}} Announced {{/if_eq}} + {{DownloadedStatus}}
diff --git a/src/UI/Movies/Index/MoviesIndexLayout.js b/src/UI/Movies/Index/MoviesIndexLayout.js index 8e87390ba..abcfdfd30 100644 --- a/src/UI/Movies/Index/MoviesIndexLayout.js +++ b/src/UI/Movies/Index/MoviesIndexLayout.js @@ -12,6 +12,7 @@ var ProfileCell = require('../../Cells/ProfileCell'); var MovieLinksCell = require('../../Cells/MovieLinksCell'); var MovieActionCell = require('../../Cells/MovieActionCell'); var MovieStatusCell = require('../../Cells/MovieStatusCell'); +var MovieDownloadStatusCell = require('../../Cells/MovieDownloadStatusCell'); var FooterView = require('./FooterView'); var FooterModel = require('./FooterModel'); var ToolbarLayout = require('../../Shared/Toolbar/ToolbarLayout'); @@ -55,6 +56,11 @@ module.exports = Marionette.Layout.extend({ cell : MovieLinksCell, className : "movie-links-cell" }, + { + name : "this", + label : "Status", + cell : MovieDownloadStatusCell, + }, { name : 'this', label : '', @@ -134,6 +140,10 @@ module.exports = Marionette.Layout.extend({ { title : 'In Cinemas', name : 'inCinemas' + }, + { + title : "Status", + name : "status", } ] }; diff --git a/src/UI/Movies/Index/Overview/SeriesOverviewItemViewTemplate.hbs b/src/UI/Movies/Index/Overview/SeriesOverviewItemViewTemplate.hbs index c222b56cb..302d431ca 100644 --- a/src/UI/Movies/Index/Overview/SeriesOverviewItemViewTemplate.hbs +++ b/src/UI/Movies/Index/Overview/SeriesOverviewItemViewTemplate.hbs @@ -40,6 +40,8 @@ {{inCinemas}} {{profile profileId}} + + {{DownloadedStatus}}