diff --git a/src/UI/Handlebars/Helpers/Quality.js b/src/UI/Handlebars/Helpers/Quality.js index d0050f577..292c04937 100644 --- a/src/UI/Handlebars/Helpers/Quality.js +++ b/src/UI/Handlebars/Helpers/Quality.js @@ -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('' + profile.get("name") + ''); + return new Handlebars.SafeString('' + profile.get('name') + ''); } return undefined; }); - }); diff --git a/src/UI/History/Details/HistoryDetailsAge.js b/src/UI/History/Details/HistoryDetailsAge.js new file mode 100644 index 000000000..d28dd317a --- /dev/null +++ b/src/UI/History/Details/HistoryDetailsAge.js @@ -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('
Age (when grabbed):
{0} {1}
'.format(age, unit)); + }); + }); diff --git a/src/UI/History/Details/HistoryDetailsView.js b/src/UI/History/Details/HistoryDetailsView.js index ba2177ac5..045189137 100644 --- a/src/UI/History/Details/HistoryDetailsView.js +++ b/src/UI/History/Details/HistoryDetailsView.js @@ -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', diff --git a/src/UI/History/Details/HistoryDetailsViewTemplate.html b/src/UI/History/Details/HistoryDetailsViewTemplate.html index 3cc969e84..19b6d3794 100644 --- a/src/UI/History/Details/HistoryDetailsViewTemplate.html +++ b/src/UI/History/Details/HistoryDetailsViewTemplate.html @@ -43,6 +43,10 @@
Download Client ID:
{{downloadClientId}}
{{/if}} + + {{#if age}} + {{historyAge}} + {{/if}} {{/with}} {{/if_eq}}