1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-07-07 00:59:18 +02:00
Files
Sonarr/UI/Cells/EpisodeStatusCell.js

44 lines
1.2 KiB
JavaScript
Raw Normal View History

2013-06-21 23:24:24 -07:00
'use strict';
define(
[
'backgrid'
], function (Backgrid) {
return Backgrid.Cell.extend({
className: 'episode-status-cell',
2013-05-20 14:42:20 -07:00
render: function () {
this.$el.empty();
2013-05-20 14:05:48 -07:00
if (this.model) {
2013-05-20 14:05:48 -07:00
var icon;
2013-07-05 13:26:50 -07:00
var tooltip;
2013-05-20 14:05:48 -07:00
2013-07-16 16:54:45 -07:00
var hasAired = Date.create(this.model.get('airDate')).isBefore(Date.create());
2013-07-16 20:25:42 -07:00
var hasFile = this.model.get('hasFile');
2013-07-16 16:54:45 -07:00
2013-07-16 20:25:42 -07:00
if (hasFile) {
icon = 'icon-ok';
2013-07-05 13:26:50 -07:00
tooltip = 'Episode downloaded';
2013-05-20 14:06:01 -07:00
}
else {
2013-07-16 20:25:42 -07:00
if (hasAired) {
icon = 'icon-warning-sign';
2013-07-05 13:26:50 -07:00
tooltip = 'Episode missing from disk';
}
else {
icon = 'icon-time';
2013-07-05 13:26:50 -07:00
tooltip = 'Episode has not aired';
}
2013-05-20 14:06:01 -07:00
}
2013-07-05 13:26:50 -07:00
this.$el.html('<i class="{0}" title="{1}"/>'.format(icon, tooltip));
2013-05-20 14:06:01 -07:00
}
2013-05-20 14:05:48 -07:00
return this;
2013-05-20 14:05:48 -07:00
}
});
});