You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
855 B
40 lines
855 B
12 years ago
|
"use strict";
|
||
|
|
||
|
define(['app', 'Episode/Layout'], function () {
|
||
12 years ago
|
NzbDrone.Cells.ToggleCell = Backgrid.Cell.extend({
|
||
12 years ago
|
|
||
|
className: 'toggle-cell clickable',
|
||
|
|
||
|
events: {
|
||
|
'click': '_onClick'
|
||
|
},
|
||
|
|
||
|
|
||
|
_onClick: function () {
|
||
|
var name = this.column.get('name');
|
||
|
this.model.set(name, !this.model.get(name));
|
||
|
this.render();
|
||
|
|
||
|
this.model.save();
|
||
|
},
|
||
12 years ago
|
|
||
|
|
||
|
render: function () {
|
||
|
this.$el.empty();
|
||
|
|
||
|
|
||
12 years ago
|
this.$el.html('<i />');
|
||
12 years ago
|
|
||
12 years ago
|
var name = this.column.get('name');
|
||
12 years ago
|
|
||
12 years ago
|
if (this.model.get(name)) {
|
||
|
this.$('i').addClass(this.column.get('trueClass'));
|
||
|
}
|
||
|
else {
|
||
|
this.$('i').addClass(this.column.get('falseClass'));
|
||
12 years ago
|
}
|
||
|
return this;
|
||
|
}
|
||
|
});
|
||
|
});
|