Merge pull request #2754 from techAPJ/patch-1

hide category name for Uncategorized topics while oneboxing
This commit is contained in:
Robin Ward 2014-09-05 11:38:13 -04:00
commit 1040a88389
2 changed files with 5 additions and 4 deletions

View File

@ -57,9 +57,10 @@ module Onebox
} }
end end
category_name = ''
category = topic.category category = topic.category
if category if category && !category.uncategorized?
category = "<a href=\"#{category.url}\" class=\"badge badge-category\" style=\"background-color: ##{category.color}; color: ##{category.text_color}\">#{category.name}</a>" category_name = "<a href=\"#{category.url}\" class=\"badge badge-category\" style=\"background-color: ##{category.color}; color: ##{category.text_color}\">#{category.name}</a>"
end end
quote = post.excerpt(SiteSetting.post_onebox_maxlength) quote = post.excerpt(SiteSetting.post_onebox_maxlength)
@ -71,7 +72,7 @@ module Onebox
views: topic.views, views: topic.views,
posters: posters, posters: posters,
quote: quote, quote: quote,
category: category, category_name: category_name,
topic: topic.id topic: topic.id
@template = 'topic' @template = 'topic'

View File

@ -2,7 +2,7 @@
<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}}} <a href="{{original_url}}">{{title}}</a> {{{category_name}}}
</div> </div>
<blockquote>{{{quote}}} <blockquote>{{{quote}}}
<div class='topic-info'> <div class='topic-info'>