FIX: Using a binding in an `{{avatar}}` was broken

This commit is contained in:
Robin Ward 2014-08-20 15:12:18 -04:00
parent 268ea0206e
commit d35633deab
2 changed files with 5 additions and 12 deletions

View File

@ -28,14 +28,8 @@
<td class='user'> <td class='user'>
{{#if flaggedPost.postAuthorFlagged}} {{#if flaggedPost.postAuthorFlagged}}
{{#if flaggedPost.user}} {{#if flaggedPost.user}}
{{#with flaggedPost}} {{#link-to 'adminUser' flaggedPost.user}}{{avatar flaggedPost.user imageSize="small"}}{{/link-to}}
{{#link-to 'adminUser' user}} {{#if flaggedPost.wasEdited}}<i class="fa fa-pencil" title="{{i18n admin.flags.was_edited}}"></i>{{/if}}
{{avatar user imageSize="small"}}
{{/link-to}}
{{#if wasEdited}}
<i class="fa fa-pencil" title="{{i18n admin.flags.was_edited}}"></i>
{{/if}}
{{/with}}
{{/if}} {{/if}}
{{/if}} {{/if}}
</td> </td>

View File

@ -1,10 +1,6 @@
export function renderAvatar(user, options) { export function renderAvatar(user, options) {
options = options || {}; options = options || {};
if (typeof user === 'string') {
user = Ember.Handlebars.get(this, user, options);
}
if (user) { if (user) {
var username = Em.get(user, 'username'); var username = Em.get(user, 'username');
if (!username) username = Em.get(user, options.usernamePath); if (!username) username = Em.get(user, options.usernamePath);
@ -41,5 +37,8 @@ export function renderAvatar(user, options) {
} }
Handlebars.registerHelper('avatar', function(user, options) { Handlebars.registerHelper('avatar', function(user, options) {
if (typeof user === 'string') {
user = Ember.Handlebars.get(this, user, options);
}
return new Handlebars.SafeString(renderAvatar.call(this, user, options.hash)); return new Handlebars.SafeString(renderAvatar.call(this, user, options.hash));
}); });