From 86d8326e307fe63c10487f32a7d40ec1ffeb438c Mon Sep 17 00:00:00 2001 From: tms Date: Sun, 10 Feb 2013 00:12:27 -0500 Subject: [PATCH] Allow forcing username as image title when generating avatar --- .../discourse/helpers/application_helpers.js.coffee | 3 ++- .../javascripts/discourse/templates/user/stream.js.handlebars | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/helpers/application_helpers.js.coffee b/app/assets/javascripts/discourse/helpers/application_helpers.js.coffee index 3fa058a0a42..269278afaeb 100644 --- a/app/assets/javascripts/discourse/helpers/application_helpers.js.coffee +++ b/app/assets/javascripts/discourse/helpers/application_helpers.js.coffee @@ -60,12 +60,13 @@ Handlebars.registerHelper 'avatar', (user, options) -> user = Ember.Handlebars.get(this, user, options) if typeof user is 'string' username = Em.get(user, 'username') username ||= Em.get(user, options.hash.usernamePath) + title = Em.get(user, 'title') || Em.get(user, 'description') unless options.hash.ignoreTitle new Handlebars.SafeString Discourse.Utilities.avatarImg( size: options.hash.imageSize extraClasses: Em.get(user, 'extras') || options.hash.extraClasses username: username - title: Em.get(user, 'title') || Em.get(user, 'description') || username + title: title || username avatarTemplate: Ember.get(user, 'avatar_template') || options.hash.avatarTemplate ) diff --git a/app/assets/javascripts/discourse/templates/user/stream.js.handlebars b/app/assets/javascripts/discourse/templates/user/stream.js.handlebars index 2b944292fa7..6fa60aa59b7 100644 --- a/app/assets/javascripts/discourse/templates/user/stream.js.handlebars +++ b/app/assets/javascripts/discourse/templates/user/stream.js.handlebars @@ -2,7 +2,7 @@ {{#collection contentBinding="stream" itemClass="item"}} {{#with view.content}}
-
{{avatar this imageSize="large" extraClasses="actor" avatarTemplatePath="avatar_template"}}
+
{{avatar this imageSize="large" extraClasses="actor" avatarTemplatePath="avatar_template" ignoreTitle="true"}}
{{date path="created_at" leaveAgo="true"}} {{unbound title}}
{{personalizedName name usernamePath="username"}}