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

View file

@ -2,7 +2,8 @@
<div class='title'> <div class='title'>
<div class='quote-controls'></div> <div class='quote-controls'></div>
{{{avatar}}} {{{avatar}}}
<a href="{{original_url}}">{{title}}</a> {{{category}}} </div> <a href="{{original_url}}">{{title}}</a> {{{category}}}
</div>
<blockquote>{{{quote}}} <blockquote>{{{quote}}}
<div class='topic-info'> <div class='topic-info'>
<div class='info-line'> <div class='info-line'>
@ -13,11 +14,7 @@
{{{avatar}}} {{{avatar}}}
{{/posters}} {{/posters}}
</div> </div>
<div class='clearfix'> <div class='clearfix'></div>
</div>
</div> </div>
</blockquote> </blockquote>
</aside> </aside>