Allow forcing username as image title when generating avatar
This commit is contained in:
parent
9e653ad370
commit
86d8326e30
|
@ -60,12 +60,13 @@ Handlebars.registerHelper 'avatar', (user, options) ->
|
||||||
user = Ember.Handlebars.get(this, user, options) if typeof user is 'string'
|
user = Ember.Handlebars.get(this, user, options) if typeof user is 'string'
|
||||||
username = Em.get(user, 'username')
|
username = Em.get(user, 'username')
|
||||||
username ||= Em.get(user, options.hash.usernamePath)
|
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(
|
new Handlebars.SafeString Discourse.Utilities.avatarImg(
|
||||||
size: options.hash.imageSize
|
size: options.hash.imageSize
|
||||||
extraClasses: Em.get(user, 'extras') || options.hash.extraClasses
|
extraClasses: Em.get(user, 'extras') || options.hash.extraClasses
|
||||||
username: username
|
username: username
|
||||||
title: Em.get(user, 'title') || Em.get(user, 'description') || username
|
title: title || username
|
||||||
avatarTemplate: Ember.get(user, 'avatar_template') || options.hash.avatarTemplate
|
avatarTemplate: Ember.get(user, 'avatar_template') || options.hash.avatarTemplate
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{{#collection contentBinding="stream" itemClass="item"}}
|
{{#collection contentBinding="stream" itemClass="item"}}
|
||||||
{{#with view.content}}
|
{{#with view.content}}
|
||||||
<div class='clearfix info'>
|
<div class='clearfix info'>
|
||||||
<a href="/users/{{unbound username}}" class='avatar-link'><div class='avatar-wrapper'>{{avatar this imageSize="large" extraClasses="actor" avatarTemplatePath="avatar_template"}}</div></a>
|
<a href="/users/{{unbound username}}" class='avatar-link'><div class='avatar-wrapper'>{{avatar this imageSize="large" extraClasses="actor" avatarTemplatePath="avatar_template" ignoreTitle="true"}}</div></a>
|
||||||
<span class='time'>{{date path="created_at" leaveAgo="true"}}</span>
|
<span class='time'>{{date path="created_at" leaveAgo="true"}}</span>
|
||||||
<a class="title" href="{{unbound postUrl}}">{{unbound title}}</a><br>
|
<a class="title" href="{{unbound postUrl}}">{{unbound title}}</a><br>
|
||||||
<a class='name' href="/users/{{unbound username}}">{{personalizedName name usernamePath="username"}}</a>
|
<a class='name' href="/users/{{unbound username}}">{{personalizedName name usernamePath="username"}}</a>
|
||||||
|
|
Loading…
Reference in New Issue