FIX: avatars in discourse's topic oneboxes

This commit is contained in:
Régis Hanol 2013-08-16 00:24:21 +02:00
parent 8303f48004
commit 9724d3bf42
2 changed files with 20 additions and 21 deletions

View File

@ -57,10 +57,12 @@ module Oneboxer
post = topic.posts.first
posters = topic.posters_summary.map do |p|
{username: p[:user][:username],
avatar: PrettyText.avatar_img(p[:user][:avatar_template], 'tiny'),
description: p[:description],
extras: p[:extras]}
{
username: p[:user].username,
avatar: PrettyText.avatar_img(p[:user].avatar_template, 'tiny'),
description: p[:description],
extras: p[:extras]
}
end
category = topic.category
@ -70,7 +72,7 @@ module Oneboxer
quote = post.excerpt(SiteSetting.post_onebox_maxlength)
args.merge! title: topic.title,
avatar: PrettyText.avatar_img(topic.user.username, 'tiny'),
avatar: PrettyText.avatar_img(topic.user.avatar_template, 'tiny'),
posts_count: topic.posts_count,
last_post: FreedomPatches::Rails4.time_ago_in_words(topic.last_posted_at, false, scope: :'datetime.distance_in_words_verbose'),
age: FreedomPatches::Rails4.time_ago_in_words(topic.created_at, false, scope: :'datetime.distance_in_words_verbose'),

View File

@ -1,23 +1,20 @@
<aside class='quote' data-post="1" data-topic="{{topic}}">
<div class='title'>
<div class='quote-controls'></div>
{{{avatar}}}
<a href="{{original_url}}">{{title}}</a> {{{category}}} </div>
<blockquote>{{{quote}}}
<div class='topic-info'>
<div class='info-line'>
{{posts_count}} posts, last post {{last_post}}, created {{age}}, {{views}} views
</div>
<div class='posters'>
{{#posters}}
{{{avatar}}}
{{/posters}}
</div>
<div class='clearfix'>
</div>
<a href="{{original_url}}">{{title}}</a> {{{category}}}
</div>
<blockquote>{{{quote}}}
<div class='topic-info'>
<div class='info-line'>
{{posts_count}} posts, last post {{last_post}}, created {{age}}, {{views}} views
</div>
<div class='posters'>
{{#posters}}
{{{avatar}}}
{{/posters}}
</div>
<div class='clearfix'></div>
</div>
</blockquote>
</aside>