mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
Moved source code under src folder - massive change
This commit is contained in:
parent
2fc8123d6b
commit
5bf0e197ec
1499 changed files with 1054 additions and 1444 deletions
42
src/UI/Handlebars/Helpers/Episode.js
Normal file
42
src/UI/Handlebars/Helpers/Episode.js
Normal file
|
@ -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';
|
||||
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue