cleaned up all the cells. there is a cell for pretty much everything.

This commit is contained in:
kay.one 2013-06-09 13:51:32 -07:00
parent ac3582d5c4
commit 70cfa5e685
42 changed files with 432 additions and 261 deletions

39
UI/Cells/ToggleCell.js Normal file
View file

@ -0,0 +1,39 @@
"use strict";
define(['app', 'Episode/Layout'], function () {
NzbDrone.Cells.ToggleCell = Backgrid.Cell.extend({
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();
},
render: function () {
this.$el.empty();
this.$el.html('<i />');
var name = this.column.get('name');
if (this.model.get(name)) {
this.$('i').addClass(this.column.get('trueClass'));
}
else {
this.$('i').addClass(this.column.get('falseClass'));
}
return this;
}
});
});