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

43 lines
1.1 KiB

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