From 4d6d477947057da8a0fbfa2b3a06dfde91b5a6de Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 13 Dec 2013 08:20:48 -0800 Subject: [PATCH] Using SortValue instead of API hack for history Fixed jshint for series collection --- src/NzbDrone.Api/History/HistoryModule.cs | 5 ----- src/UI/History/Table/HistoryTableLayout.js | 3 ++- src/UI/Mixins/AsPersistedStateCollection.js | 2 +- src/UI/Series/SeriesCollection.js | 4 ++-- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/NzbDrone.Api/History/HistoryModule.cs b/src/NzbDrone.Api/History/HistoryModule.cs index bae183df6..7b0aa3c7e 100644 --- a/src/NzbDrone.Api/History/HistoryModule.cs +++ b/src/NzbDrone.Api/History/HistoryModule.cs @@ -39,11 +39,6 @@ namespace NzbDrone.Api.History pagingSpec.FilterExpression = h => h.EpisodeId == i; } - if (pagingSpec.SortKey.Equals("series", StringComparison.InvariantCultureIgnoreCase)) - { - pagingSpec.SortKey = "series.title"; - } - return ApplyToPage(_historyService.Paged, pagingSpec); } diff --git a/src/UI/History/Table/HistoryTableLayout.js b/src/UI/History/Table/HistoryTableLayout.js index 25dff7526..3571c69d1 100644 --- a/src/UI/History/Table/HistoryTableLayout.js +++ b/src/UI/History/Table/HistoryTableLayout.js @@ -45,7 +45,8 @@ define( { name : 'series', label: 'Series', - cell : SeriesTitleCell + cell : SeriesTitleCell, + sortValue: 'series.title' }, { name : 'episode', diff --git a/src/UI/Mixins/AsPersistedStateCollection.js b/src/UI/Mixins/AsPersistedStateCollection.js index 518209fe7..721c4c68a 100644 --- a/src/UI/Mixins/AsPersistedStateCollection.js +++ b/src/UI/Mixins/AsPersistedStateCollection.js @@ -40,7 +40,7 @@ define( var _storeState = function (column, sortDirection) { var order = _convertDirectionToInt(sortDirection); - var sortKey = column.get('name'); + var sortKey = column.has('sortValue') ? column.get('sortValue') : column.get('name'); Config.setValue('{0}.sortKey'.format(this.tableName), sortKey); Config.setValue('{0}.sortDirection'.format(this.tableName), order); diff --git a/src/UI/Series/SeriesCollection.js b/src/UI/Series/SeriesCollection.js index 462e88fdc..74c16f27d 100644 --- a/src/UI/Series/SeriesCollection.js +++ b/src/UI/Series/SeriesCollection.js @@ -47,7 +47,7 @@ define( } }); - var mixedIn = AsPersistedStateCollection.call(Collection); - var collection = new mixedIn(SeriesData); + var MixedIn = AsPersistedStateCollection.call(Collection); + var collection = new MixedIn(SeriesData); return collection; });