add category-logo-link component

This commit is contained in:
scossar 2015-12-28 14:39:27 -08:00
parent 6ef1537ee0
commit 993f63ee2b
2 changed files with 14 additions and 1 deletions

View file

@ -0,0 +1,13 @@
export default Em.Component.extend({
tagName: 'a',
attributeBindings: ['href'],
href: function() {
return Discourse.getURL('/c/') + Discourse.Category.slugFor(this.get('category'))
}.property(),
render(buffer) {
const category = this.get('category');
const categoryLogo = category.get('logo_url');
buffer.push(`<img class="category-logo" src='${categoryLogo}'/>`);
}
});

View file

@ -16,7 +16,7 @@
{{category-title-link category=c}}
{{category-unread category=c}}
{{#if c.logo_url}}
<img class="category-logo" src={{c.logo_url}}>
{{category-logo-link category=c}}
{{/if}}
<div class="category-description">