PERF: optimise rendering of posts

This commit is contained in:
Sam 2014-12-10 18:05:04 +11:00
parent ccdae40913
commit 0542c080b3
4 changed files with 10 additions and 21 deletions

View File

@ -1,12 +0,0 @@
export default Ember.Component.extend({
tagName: 'a',
attributeBindings: ['href','data-user-card'],
classNames: ['trigger-user-card'],
href: Em.computed.oneWay('post.usernameUrl'),
"data-user-card": Em.computed.oneWay('post.username'),
render: function(buffer) {
var avatar = Handlebars.helpers.avatar(this.get('post'), {hash: {imageSize: 'large'}});
buffer.push(avatar);
}
});

View File

@ -2,7 +2,7 @@
<div class='topic-avatar'>
<div class='contents'>
<div>
{{poster-avatar post=this classNames="main-avatar"}}
{{raw "post/poster-avatar" post=this classNames="main-avatar"}}
</div>
</div>
</div>

View File

@ -9,11 +9,11 @@
<div class='topic-avatar'>
<div class="contents">
{{#unless userDeleted}}
{{poster-avatar post=this classNames="main-avatar"}}
{{else}}
{{#unboundIf userDeleted}}
<i class="fa fa-trash-o deleted-user-avatar"></i>
{{/unless}}
{{else}}
{{raw "post/poster-avatar" post=this classNames="main-avatar"}}
{{/unboundIf}}
{{plugin-outlet "poster-avatar-bottom"}}
</div>
</div>
@ -42,14 +42,14 @@
{{#if wiki}}
<div class="post-info wiki" title="{{i18n 'post.wiki.about'}}" {{action "editPost" this}}>{{fa-icon "pencil-square-o"}}</div>
{{/if}}
{{#if via_email}}
{{#unboundIf via_email}}
{{#if canViewRawEmail}}
<div class="post-info via-email raw-email" title="{{i18n 'post.via_email'}}" {{action "showRawEmail" this}}>{{fa-icon "envelope-o"}}</div>
{{else}}
<div class="post-info via-email" title="{{i18n 'post.via_email'}}">{{fa-icon "envelope-o"}}</div>
{{/if}}
{{/if}}
{{#if showUserReplyTab}}
{{/unboundIf}}
{{#unboundIf showUserReplyTab}}
<a href {{action "toggleReplyHistory" this target="view"}} class='reply-to-tab'>
{{#if loadingReplyHistory}}
{{i18n 'loading'}}
@ -59,7 +59,7 @@
<span>{{reply_to_user.username}}</span>
{{/if}}
</a>
{{/if}}
{{/unboundIf}}
<div {{bind-attr class=":read-state read"}} title="{{i18n 'post.unread'}}">{{fa-icon "circle"}}</div>
</div>

View File

@ -0,0 +1 @@
<a href="{{post.usernameUrl}}" classNames="trigger-user-card {{classNames}}" data-user-card="{{post.username}}">{{avatar post imageSize="large"}}</a>