Show published date in history details and manual search

New: Hover over age in manual search to see published date
New: Show published date in history details for grab events
This commit is contained in:
Mark McDowall
2014-11-28 23:39:59 -08:00
parent 119677e2dd
commit a83f49ca32
7 changed files with 771 additions and 423 deletions
+12 -7
View File
@@ -1,10 +1,10 @@
'use strict';
define(
[
'moment',
'backgrid',
'Shared/UiSettingsModel',
'Shared/FormatHelpers'
], function (Backgrid, FormatHelpers) {
], function (moment, Backgrid, UiSettings, FormatHelpers) {
return Backgrid.Cell.extend({
className: 'age-cell',
@@ -12,14 +12,17 @@ define(
render: function () {
var age = this.model.get('age');
var ageHours = this.model.get('ageHours');
var published = moment(this.model.get('publishDate'));
var publishedFormatted = published.format('{0} LTS'.format(UiSettings.get('shortDateFormat')));
var formatted = age;
var suffix = this.plural(age, 'day');
if (age === 0) {
this.$el.html('{0} {1}'.format(ageHours.toFixed(1), this.plural(Math.round(ageHours), 'hour')));
formatted = ageHours.toFixed(1);
suffix = this.plural(Math.round(ageHours), 'hour');
}
else {
this.$el.html('{0} {1}'.format(age, this.plural(age, 'day')));
}
this.$el.html('<div title="{2}">{0} {1}</div>'.format(formatted, suffix, publishedFormatted));
this.delegateEvents();
return this;
@@ -34,3 +37,5 @@ define(
}
});
});
'use strict';