1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Merge pull request #2497 from geogolem/selectAllMovieEditor

selectAll and deselectAll MovieEditor buttons
This commit is contained in:
geogolem 2018-02-09 11:59:31 -05:00 committed by GitHub
commit 8edd15b5f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,6 +111,18 @@ module.exports = Marionette.Layout.extend({
icon : 'icon-radarr-delete-white',
className: 'btn-danger',
callback : this._deleteSelected
},
{
title : 'Select All',
icon : 'icon-sonarr-checked',
className: 'btn-primary',
callback : this._selectAll
},
{
title : 'Unselect All',
icon : 'icon-sonarr-unchecked',
className: 'btn-primary',
callback : this._unselectAll
}
]
};
@ -245,5 +257,28 @@ module.exports = Marionette.Layout.extend({
var updateFilesMoviesView = new DeleteSelectedView({ movies : selected });
vent.trigger(vent.Commands.OpenModalCommand, updateFilesMoviesView);
}
},
_selectAll : function() {
var pageSize = this.movieCollection.state.pageSize;
var currentPage = this.movieCollection.state.currentPage;
this.movieCollection.setPageSize(this.movieCollection.fullCollection.length, { fetch: false});
this.movieCollection.each(function(model) {
model.trigger('backgrid:selected', model, true);
});
this.movieCollection.setPageSize(pageSize, {fetch: false});
this.movieCollection.getPage(currentPage, {fetch: false});
},
_unselectAll : function() {
var pageSize = this.movieCollection.state.pageSize;
var currentPage = this.movieCollection.state.currentPage;
this.movieCollection.setPageSize(this.movieCollection.fullCollection.length, { fetch: false});
this.movieCollection.each(function(model) {
model.trigger('backgrid:selected', model, false);
});
this.movieCollection.setPageSize(pageSize, {fetch: false});
this.movieCollection.getPage(currentPage, {fetch: false});
}
});