mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
New: Show age when grabbed on history details
This commit is contained in:
parent
140427c76e
commit
f008d85657
@ -2,20 +2,18 @@
|
||||
define(
|
||||
[
|
||||
'handlebars',
|
||||
'Quality/QualityProfileCollection',
|
||||
'underscore'
|
||||
], function (Handlebars, QualityProfileCollection, _) {
|
||||
'Quality/QualityProfileCollection'
|
||||
], function (Handlebars, QualityProfileCollection) {
|
||||
|
||||
Handlebars.registerHelper('qualityProfile', function (profileId) {
|
||||
|
||||
var profile = QualityProfileCollection.get(profileId);
|
||||
|
||||
if (profile) {
|
||||
return new Handlebars.SafeString('<span class="label label-default quality-profile-label">' + profile.get("name") + '</span>');
|
||||
return new Handlebars.SafeString('<span class="label label-default quality-profile-label">' + profile.get('name') + '</span>');
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
19
src/UI/History/Details/HistoryDetailsAge.js
Normal file
19
src/UI/History/Details/HistoryDetailsAge.js
Normal file
@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'handlebars'
|
||||
], function (Handlebars) {
|
||||
|
||||
Handlebars.registerHelper('historyAge', function () {
|
||||
|
||||
var unit = 'days';
|
||||
var age = this.age;
|
||||
|
||||
if (age < 2) {
|
||||
unit = 'hours';
|
||||
age = parseFloat(this.ageHours).toFixed(1);
|
||||
}
|
||||
|
||||
return new Handlebars.SafeString('<dt>Age (when grabbed):</dt><dd>{0} {1}</dd>'.format(age, unit));
|
||||
});
|
||||
});
|
@ -1,10 +1,11 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'jquery',
|
||||
'vent',
|
||||
'marionette',
|
||||
'jquery'
|
||||
], function (vent, Marionette, $) {
|
||||
'History/Details/HistoryDetailsAge'
|
||||
], function ($, vent, Marionette) {
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'History/Details/HistoryDetailsViewTemplate',
|
||||
|
@ -43,6 +43,10 @@
|
||||
<dt>Download Client ID:</dt>
|
||||
<dd>{{downloadClientId}}</dd>
|
||||
{{/if}}
|
||||
|
||||
{{#if age}}
|
||||
{{historyAge}}
|
||||
{{/if}}
|
||||
{{/with}}
|
||||
</dl>
|
||||
{{/if_eq}}
|
||||
|
Loading…
Reference in New Issue
Block a user