mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-31 04:00:18 -07:00
UI Cleanup - Updated Form and Handlebars subtree.
This commit is contained in:
parent
fb7988edb8
commit
a5fd28326e
13 changed files with 345 additions and 311 deletions
|
@ -3,51 +3,59 @@ var FormatHelpers = require('../../Shared/FormatHelpers');
|
|||
var moment = require('moment');
|
||||
require('../../Activity/Queue/QueueCollection');
|
||||
|
||||
module.exports = (function(){
|
||||
Handlebars.registerHelper('EpisodeNumber', function(){
|
||||
if(this.series.seriesType === 'daily') {
|
||||
return moment(this.airDate).format('L');
|
||||
Handlebars.registerHelper('EpisodeNumber', function() {
|
||||
|
||||
if (this.series.seriesType === 'daily') {
|
||||
return moment(this.airDate).format('L');
|
||||
} else if (this.series.seriesType === 'anime' && this.absoluteEpisodeNumber !== undefined) {
|
||||
return '{0}x{1} ({2})'.format(this.seasonNumber, FormatHelpers.pad(this.episodeNumber, 2), FormatHelpers.pad(this.absoluteEpisodeNumber, 2));
|
||||
} else {
|
||||
return '{0}x{1}'.format(this.seasonNumber, FormatHelpers.pad(this.episodeNumber, 2));
|
||||
}
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('StatusLevel', function() {
|
||||
var hasFile = this.hasFile;
|
||||
var downloading = require('../../Activity/Queue/QueueCollection').findEpisode(this.id) || this.downloading;
|
||||
var currentTime = moment();
|
||||
var start = moment(this.airDateUtc);
|
||||
var end = moment(this.end);
|
||||
|
||||
if (hasFile) {
|
||||
return 'success';
|
||||
}
|
||||
|
||||
if (downloading) {
|
||||
return 'purple';
|
||||
}
|
||||
|
||||
if (this.episodeNumber === 1) {
|
||||
return 'premiere';
|
||||
}
|
||||
|
||||
if (currentTime.isAfter(start) && currentTime.isBefore(end)) {
|
||||
return 'warning';
|
||||
}
|
||||
|
||||
if (start.isBefore(currentTime) && !hasFile) {
|
||||
return 'danger';
|
||||
}
|
||||
|
||||
return 'primary';
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('EpisodeProgressClass', function() {
|
||||
if (this.episodeFileCount === this.episodeCount) {
|
||||
if (this.status === 'continuing') {
|
||||
return '';
|
||||
}
|
||||
else if(this.series.seriesType === 'anime' && this.absoluteEpisodeNumber !== undefined) {
|
||||
return '{0}x{1} ({2})'.format(this.seasonNumber, FormatHelpers.pad(this.episodeNumber, 2), FormatHelpers.pad(this.absoluteEpisodeNumber, 2));
|
||||
}
|
||||
else {
|
||||
return '{0}x{1}'.format(this.seasonNumber, FormatHelpers.pad(this.episodeNumber, 2));
|
||||
}
|
||||
});
|
||||
Handlebars.registerHelper('StatusLevel', function(){
|
||||
var hasFile = this.hasFile;
|
||||
var downloading = require('../../Activity/Queue/QueueCollection').findEpisode(this.id) || this.downloading;
|
||||
var currentTime = moment();
|
||||
var start = moment(this.airDateUtc);
|
||||
var end = moment(this.end);
|
||||
if(hasFile) {
|
||||
return 'success';
|
||||
}
|
||||
if(downloading) {
|
||||
return 'purple';
|
||||
}
|
||||
if(this.episodeNumber === 1) {
|
||||
return 'premiere';
|
||||
}
|
||||
if(currentTime.isAfter(start) && currentTime.isBefore(end)) {
|
||||
return 'warning';
|
||||
}
|
||||
if(start.isBefore(currentTime) && !hasFile) {
|
||||
return 'danger';
|
||||
}
|
||||
return 'primary';
|
||||
});
|
||||
Handlebars.registerHelper('EpisodeProgressClass', function(){
|
||||
if(this.episodeFileCount === this.episodeCount) {
|
||||
if(this.status === 'continuing') {
|
||||
return '';
|
||||
}
|
||||
return 'progress-bar-success';
|
||||
}
|
||||
if(this.monitored) {
|
||||
return 'progress-bar-danger';
|
||||
}
|
||||
return 'progress-bar-warning';
|
||||
});
|
||||
}).call(this);
|
||||
|
||||
return 'progress-bar-success';
|
||||
}
|
||||
|
||||
if (this.monitored) {
|
||||
return 'progress-bar-danger';
|
||||
}
|
||||
|
||||
return 'progress-bar-warning';
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue