PERF: use handlebars rendering for user list
this shave topic list rendering on local down from 140ms to 100ms
This commit is contained in:
parent
7d6d8bd0a3
commit
adb870a909
|
@ -0,0 +1,17 @@
|
|||
Handlebars.registerHelper('handlebars', function(property, options) {
|
||||
|
||||
var template = Em.TEMPLATES[property + ".raw"];
|
||||
var params = options.hash;
|
||||
|
||||
if(params) {
|
||||
for(var prop in params){
|
||||
params[prop] = Em.Handlebars.get(this, params[prop]) || params[prop];
|
||||
}
|
||||
}
|
||||
|
||||
return new Handlebars.SafeString(template(params));
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('get', function(property) {
|
||||
return Em.get(this, property);
|
||||
});
|
|
@ -31,7 +31,7 @@
|
|||
<td class='category'>{{bound-category-link category showParent=true}}</td>
|
||||
{{/unless}}
|
||||
|
||||
{{view 'posters-column' posters=posters}}
|
||||
{{handlebars 'posters_column' posters=posters}}
|
||||
|
||||
{{posts-count-column topic=model class="num" action="showTopicEntrance"}}
|
||||
<td {{bind-attr class=":num :views viewsHeat"}}>{{number views numberKey="views_long"}}</td>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<td class='posters'>
|
||||
{{#each posters}}
|
||||
<a href="{{get "user.path"}}" data-user-card="{{this.user.username}}" class="{{get "extras"}}">{{avatar this usernamePath="user.username" imageSize="small"}}</a>
|
||||
{{/each}}
|
||||
</td>
|
Loading…
Reference in New Issue