1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-29 03:15:19 +00:00
Radarr/UI/Cells/ToggleCell.js

40 lines
834 B
JavaScript
Raw Normal View History

2013-06-22 06:24:24 +00:00
'use strict';
2013-06-09 06:20:38 +00:00
define(['app', 'Episode/Layout'], function () {
2013-06-24 02:31:02 +00:00
return 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();
},
2013-06-09 06:20:38 +00:00
render: function () {
this.$el.empty();
this.$el.html('<i />');
2013-06-09 06:20:38 +00:00
var name = this.column.get('name');
2013-06-09 06:20:38 +00:00
if (this.model.get(name)) {
this.$('i').addClass(this.column.get('trueClass'));
}
else {
this.$('i').addClass(this.column.get('falseClass'));
2013-06-09 06:20:38 +00:00
}
return this;
}
});
});