mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-25 22:36:59 -04:00
Moved source code under src folder - massive change
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
'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';
|
||||
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user