1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-19 21:46:50 -04:00
Files
Radarr/src/UI/System/Task/NextExecutionCell.js
T
2014-12-15 19:43:41 -08:00

47 lines
1.3 KiB
JavaScript

'use strict';
define(
[
'Cells/NzbDroneCell',
'moment',
'Shared/UiSettingsModel'
], function (NzbDroneCell, moment, UiSettings) {
return NzbDroneCell.extend({
className: 'next-execution-cell',
render: function () {
this.$el.empty();
var interval = this.model.get('interval');
var nextExecution = moment(this.model.get('nextExecution'));
if (interval === 0 ) {
this.$el.html('-');
}
else if (moment().isAfter(nextExecution)) {
this.$el.html('now');
}
else {
var result = '<span title="{0}">{1}</span>';
var tooltip = nextExecution.format(UiSettings.longDateTime());
var text;
if (UiSettings.get('showRelativeDates')) {
text = nextExecution.fromNow();
}
else {
text = nextExecution.format(UiSettings.shortDateTime());
}
this.$el.html(result.format(tooltip, text));
}
return this;
}
});
});