mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-20 21:55:03 -04:00
UI Cleanup - Updated Cells subtree.
This commit is contained in:
@@ -3,32 +3,41 @@ var _ = require('underscore');
|
||||
var BackgridSelectAll = require('backgrid.selectall');
|
||||
|
||||
module.exports = BackgridSelectAll.extend({
|
||||
enterEditMode : function(e){
|
||||
if(e.shiftKey && this.model.collection.lastToggled) {
|
||||
enterEditMode : function(e) {
|
||||
if (e.shiftKey && this.model.collection.lastToggled) {
|
||||
this._selectRange();
|
||||
}
|
||||
|
||||
var checked = $(e.target).prop('checked');
|
||||
|
||||
this.model.collection.lastToggled = this.model;
|
||||
this.model.collection.checked = checked;
|
||||
},
|
||||
onChange : function(e){
|
||||
|
||||
onChange : function(e) {
|
||||
var checked = $(e.target).prop('checked');
|
||||
this.$el.parent().toggleClass('selected', checked);
|
||||
this.model.trigger('backgrid:selected', this.model, checked);
|
||||
},
|
||||
_selectRange : function(){
|
||||
|
||||
_selectRange : function() {
|
||||
var collection = this.model.collection;
|
||||
var lastToggled = collection.lastToggled;
|
||||
var checked = collection.checked;
|
||||
|
||||
var currentIndex = collection.indexOf(this.model);
|
||||
var lastIndex = collection.indexOf(lastToggled);
|
||||
|
||||
var low = Math.min(currentIndex, lastIndex);
|
||||
var high = Math.max(currentIndex, lastIndex);
|
||||
var range = _.range(low + 1, high);
|
||||
_.each(range, function(index){
|
||||
|
||||
_.each(range, function(index) {
|
||||
var model = collection.at(index);
|
||||
|
||||
model.trigger('backgrid:select', model, checked);
|
||||
});
|
||||
|
||||
this.model.collection.lastToggled = undefined;
|
||||
this.model.collection.checked = undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user