diff --git a/src/UI/History/Queue/QueueCollection.js b/src/UI/History/Queue/QueueCollection.js index a66393435..b5c32e6a3 100644 --- a/src/UI/History/Queue/QueueCollection.js +++ b/src/UI/History/Queue/QueueCollection.js @@ -3,13 +3,20 @@ define( [ 'underscore', 'backbone', + 'backbone.pageable', 'History/Queue/QueueModel', 'Mixins/backbone.signalr.mixin' - ], function (_, Backbone, QueueModel) { - var QueueCollection = Backbone.Collection.extend({ + ], function (_, Backbone, PageableCollection, QueueModel) { + var QueueCollection = PageableCollection.extend({ url : window.NzbDrone.ApiRoot + '/queue', model: QueueModel, + state: { + pageSize: 15 + }, + + mode: 'client', + findEpisode: function (episodeId) { return _.find(this.models, function (queueModel) { return queueModel.get('episode').id === episodeId; diff --git a/src/UI/History/Queue/QueueLayout.js b/src/UI/History/Queue/QueueLayout.js index 612ec0297..b20044fd8 100644 --- a/src/UI/History/Queue/QueueLayout.js +++ b/src/UI/History/Queue/QueueLayout.js @@ -9,7 +9,8 @@ define( 'Cells/EpisodeTitleCell', 'Cells/QualityCell', 'History/Queue/QueueStatusCell', - 'History/Queue/TimeleftCell' + 'History/Queue/TimeleftCell', + 'Shared/Grid/Pager' ], function (Marionette, Backgrid, QueueCollection, @@ -18,12 +19,14 @@ define( EpisodeTitleCell, QualityCell, QueueStatusCell, - TimeleftCell) { + TimeleftCell, + GridPager) { return Marionette.Layout.extend({ template: 'History/Queue/QueueLayoutTemplate', regions: { - table: '#x-queue' + table: '#x-queue', + pager: '#x-queue-pager' }, columns: @@ -65,7 +68,6 @@ define( } ], - initialize: function () { this.listenTo(QueueCollection, 'sync', this._showTable); }, @@ -80,6 +82,11 @@ define( collection: QueueCollection, className : 'table table-hover' })); + + this.pager.show(new GridPager({ + columns : this.columns, + collection: QueueCollection + })); } }); }); diff --git a/src/UI/History/Queue/QueueLayoutTemplate.html b/src/UI/History/Queue/QueueLayoutTemplate.html index 113673518..89041b644 100644 --- a/src/UI/History/Queue/QueueLayoutTemplate.html +++ b/src/UI/History/Queue/QueueLayoutTemplate.html @@ -3,3 +3,9 @@
+ +
+
+
+
+
\ No newline at end of file diff --git a/src/UI/History/Table/HistoryTableLayout.js b/src/UI/History/Table/HistoryTableLayout.js index 3571c69d1..f4a9dcd04 100644 --- a/src/UI/History/Table/HistoryTableLayout.js +++ b/src/UI/History/Table/HistoryTableLayout.js @@ -79,7 +79,6 @@ define( } ], - initialize: function () { this.collection = new HistoryCollection({ tableName: 'history' }); this.listenTo(this.collection, 'sync', this._showTable); @@ -104,6 +103,5 @@ define( this.history.show(new LoadingView()); this.collection.fetch(); } - }); });