FIX: User Pill errors

This commit is contained in:
Robin Ward
2013-06-10 18:35:01 -04:00
parent ab5507ac06
commit 850123dce8
4 changed files with 22 additions and 6 deletions

View File

@ -7,10 +7,10 @@
@module Discourse
**/
Discourse.UserPrivateMessagesController = Discourse.ObjectController.extend({
needs: ['composer'],
composePrivateMessage: function() {
var composerController = Discourse.get('router.composerController');
return composerController.open({
this.get('controllers.composer').open({
action: Discourse.Composer.PRIVATE_MESSAGE,
archetypeId: 'private_message',
draftKey: 'new_private_message'

View File

@ -166,6 +166,21 @@ Handlebars.registerHelper('avatar', function(user, options) {
}
});
/**
Bound avatar helper.
@method boundAvatar
@for Handlebars
**/
Ember.Handlebars.registerBoundHelper('boundAvatar', function(user, options) {
var username = Em.get(user, 'username');
return new Handlebars.SafeString(Discourse.Utilities.avatarImg({
size: options.hash.imageSize,
username: username,
avatarTemplate: Ember.get(user, 'avatar_template')
}));
});
/**
Nicely format a date without a binding since the date doesn't need to change.

View File

@ -8,7 +8,8 @@
**/
Discourse.RestrictedUserRoute = Discourse.Route.extend({
redirect: function(user) {
redirect: function() {
var user = this.modelFor('user');
if (!user.get('can_edit')) {
this.transitionTo('user.activity', user);
}

View File

@ -2,13 +2,13 @@
<div class="user-heading">
<div class="container">
<div class="full-width" id='user-menu'>
<h1>{{name}}<span>{{unbound username}}{{{unbound statusIcon}}}</span></h1>
<h1>{{name}}<span>{{username}}{{{statusIcon}}}</span></h1>
{{#if viewingSelf}}
<button {{action "logout" target="Discourse"}} class='btn'>{{i18n user.log_out}}</button>
{{/if}}
{{#if currentUser.staff}}
<a href="{{unbound adminPath}}" class='btn'><i class="icon-wrench"></i>&nbsp;{{i18n admin.user.show_admin_profile}}</a>
<a {{bindAttr href="adminPath"}} class='btn'><i class="icon-wrench"></i>&nbsp;{{i18n admin.user.show_admin_profile}}</a>
{{/if}}
<ul class="nav nav-pills">
<li>
@ -29,7 +29,7 @@
{{/if}}
</ul>
<div class='avatar-wrapper'>
{{avatar model imageSize="120"}}
{{boundAvatar model imageSize="120"}}
</div>
</div>
</div>