mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Cold/Hot classes in Topic Map
This commit is contained in:
parent
06e9cbc6cb
commit
1bbd1a94bb
2 changed files with 18 additions and 15 deletions
|
@ -267,30 +267,32 @@ Ember.Handlebars.registerHelper('float', function(property, options) {
|
|||
@for Handlebars
|
||||
**/
|
||||
Handlebars.registerHelper('number', function(property, options) {
|
||||
var n, orig, title, result;
|
||||
orig = parseInt(Ember.Handlebars.get(this, property, options), 10);
|
||||
if (isNaN(orig)) {
|
||||
orig = 0;
|
||||
}
|
||||
title = orig;
|
||||
|
||||
var orig = parseInt(Ember.Handlebars.get(this, property, options), 10);
|
||||
if (isNaN(orig)) { orig = 0; }
|
||||
|
||||
var title = orig;
|
||||
if (options.hash.numberKey) {
|
||||
title = I18n.t(options.hash.numberKey, {
|
||||
number: orig
|
||||
});
|
||||
title = I18n.t(options.hash.numberKey, { number: orig });
|
||||
}
|
||||
|
||||
// Round off the thousands to one decimal place
|
||||
n = orig;
|
||||
var n = orig;
|
||||
if (orig > 999 && !options.hash.noTitle) {
|
||||
n = (orig / 1000).toFixed(1) + "K";
|
||||
}
|
||||
|
||||
result = "<span class='number'";
|
||||
var classNames = 'number';
|
||||
if (options.hash['class']) {
|
||||
classNames += ' ' + Ember.Handlebars.get(this, options.hash['class'], options);
|
||||
}
|
||||
var result = "<span class='" + classNames + "'";
|
||||
|
||||
if(n !== title) {
|
||||
if (n !== title) {
|
||||
result += " title='" + title + "'";
|
||||
}
|
||||
|
||||
result += ">" + n + "</span>";
|
||||
|
||||
return new Handlebars.SafeString(result);
|
||||
});
|
||||
|
||||
|
@ -310,6 +312,7 @@ Handlebars.registerHelper('date', function(property, options) {
|
|||
property = property.hash.path;
|
||||
}
|
||||
}
|
||||
|
||||
var val = Ember.Handlebars.get(this, property, options);
|
||||
if (val) {
|
||||
var date = new Date(val);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<section {{bindAttr class=":map mapCollapsed"}}>
|
||||
<ul class="clearfix">
|
||||
<li>
|
||||
<a href='{{unbound topic.url}}'>
|
||||
<a href='{{unbound topic.url}}' {{bindAttr class=topic.ageCold}}>
|
||||
<h4>{{i18n created}}</h4>
|
||||
{{avatar details.created_by imageSize="tiny"}}
|
||||
{{date topic.created_at}}
|
||||
|
@ -26,7 +26,7 @@
|
|||
</li>
|
||||
<li class='secondary'>
|
||||
<h4>{{i18n views}}</h4>
|
||||
{{number topic.views}}
|
||||
{{number topic.views class=topic.viewsHeat}}
|
||||
</li>
|
||||
<li class='secondary'>
|
||||
<h4>{{i18n users}}</h4>
|
||||
|
|
Loading…
Reference in a new issue