added toggle cell for episode ignore status.

This commit is contained in:
kay.one 2013-06-08 23:21:32 -07:00
parent ca71025bca
commit dc2930dc98
6 changed files with 48 additions and 32 deletions

View file

@ -1,33 +1,38 @@
"use strict";
define(['app', 'Episode/Layout'], function () {
NzbDrone.Series.Details.EpisodeIgnoreCell = Backgrid.Cell.extend({
NzbDrone.Shared.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();
},
className: 'episode-status-cell',
render: function () {
this.$el.empty();
if (this.model) {
var icon;
this.$el.html('<i />');
if (this.model.get('episodeFile')) {
icon = 'icon-ok';
var name = this.column.get('name');
}
else {
if (this.model.get('hasAired')) {
icon = 'icon-warning-sign';
}
else {
icon = 'icon-time';
}
}
this.$el.html('<i class="{0}"/>'.format(icon));
if (this.model.get(name)) {
this.$('i').addClass(this.column.get('trueClass'));
}
else {
this.$('i').addClass(this.column.get('falseClass'));
}
return this;
}
});