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.
Sonarr/UI/Handlebars/Helpers/Episode.js

42 lines
1.0 KiB

'use strict';
define(
[
'handlebars',
'Shared/FormatHelpers'
], function (Handlebars, FormatHelpers) {
Handlebars.registerHelper('EpisodeNumber', function () {
if (this.series.seriesType === 'daily') {
return FormatHelpers.DateHelper(this.airDate);
}
else {
return '{0}x{1}'.format(this.seasonNumber, this.episodeNumber.pad(2));
}
});
Handlebars.registerHelper('StatusLevel', function () {
var hasFile = this.hasFile;
var currentTime = Date.create();
var start = Date.create(this.airDate);
var end = Date.create(this.end);
if (currentTime.isBetween(start, end)) {
return 'warning';
}
if (start.isBefore(currentTime) && !hasFile) {
return 'danger';
}
if (hasFile) {
return 'success';
}
return 'primary';
});
});