From ad46a490cce134e3ad75b01e0c54632a27a241ad Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 28 Oct 2014 17:54:00 +1100 Subject: [PATCH] correct coldmaps --- .../javascripts/discourse/helpers/cold-age-class.js.es6 | 8 +++++++- .../discourse/templates/list/activity_column.raw.hbs | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/helpers/cold-age-class.js.es6 b/app/assets/javascripts/discourse/helpers/cold-age-class.js.es6 index 0fa515ea7a2..1727448e6fd 100644 --- a/app/assets/javascripts/discourse/helpers/cold-age-class.js.es6 +++ b/app/assets/javascripts/discourse/helpers/cold-age-class.js.es6 @@ -12,8 +12,14 @@ function coldAgeClass(property, options) { if (!dt) { return className; } + var startDate = (options && options.hash && options.hash.startDate) || new Date(); + + if (typeof startDate === "string") { + startDate = Em.Handlebars.get(this, startDate, options); + } + // Show heat on age - var nowDays = daysSinceEpoch(new Date()), + var nowDays = daysSinceEpoch(startDate), epochDays = daysSinceEpoch(new Date(dt)); if (nowDays - epochDays > Discourse.SiteSettings.cold_age_days_high) return className + ' coldmap-high'; diff --git a/app/assets/javascripts/discourse/templates/list/activity_column.raw.hbs b/app/assets/javascripts/discourse/templates/list/activity_column.raw.hbs index 1eba1324169..7f532c9b57d 100644 --- a/app/assets/javascripts/discourse/templates/list/activity_column.raw.hbs +++ b/app/assets/javascripts/discourse/templates/list/activity_column.raw.hbs @@ -1 +1 @@ -<{{this.tagName}} class="{{cold-age-class "topic.bumpedAt" class=this.class}} activity" title="{{get "topic.bumpedAtTitle"}}">{{format-date "topic.bumpedAt" format="tiny" noTitle=true}} +<{{this.tagName}} class="{{cold-age-class "topic.createdAt" startDate="topic.bumpedAt" class=this.class}} activity" title="{{get "topic.bumpedAtTitle"}}">{{format-date "topic.bumpedAt" format="tiny" noTitle=true}}