selectAll and deselectAll MovieEditor buttons

This commit is contained in:
geogolem 2018-02-09 11:41:31 -05:00
parent 8b201af053
commit 2fdfd0fba5
1 changed files with 36 additions and 1 deletions

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});
}
});