correct coldmaps

This commit is contained in:
Sam 2014-10-28 17:54:00 +11:00
parent f5379cee89
commit ad46a490cc
2 changed files with 8 additions and 2 deletions

View File

@ -12,8 +12,14 @@ function coldAgeClass(property, options) {
if (!dt) { return className; } 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 // Show heat on age
var nowDays = daysSinceEpoch(new Date()), var nowDays = daysSinceEpoch(startDate),
epochDays = daysSinceEpoch(new Date(dt)); epochDays = daysSinceEpoch(new Date(dt));
if (nowDays - epochDays > Discourse.SiteSettings.cold_age_days_high) return className + ' coldmap-high'; if (nowDays - epochDays > Discourse.SiteSettings.cold_age_days_high) return className + ' coldmap-high';

View File

@ -1 +1 @@
<{{this.tagName}} class="{{cold-age-class "topic.bumpedAt" class=this.class}} activity" title="{{get "topic.bumpedAtTitle"}}"><a href="{{get "topic.lastPostUrl"}}">{{format-date "topic.bumpedAt" format="tiny" noTitle=true}}</a></{{this.tagName}}> <{{this.tagName}} class="{{cold-age-class "topic.createdAt" startDate="topic.bumpedAt" class=this.class}} activity" title="{{get "topic.bumpedAtTitle"}}"><a href="{{get "topic.lastPostUrl"}}">{{format-date "topic.bumpedAt" format="tiny" noTitle=true}}</a></{{this.tagName}}>