2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

UX: Show category description beside logo

This commit is contained in:
Robin Ward 2015-12-04 12:36:09 -05:00
parent 83be335c54
commit 80bdc7333c
2 changed files with 21 additions and 29 deletions

View file

@ -1,19 +1,17 @@
import { iconHTML } from 'discourse/helpers/fa-icon';
export default Em.Component.extend({ export default Em.Component.extend({
tagName: 'h3', tagName: 'h3',
render: function(buffer) { render(buffer) {
var category = this.get('category'), const category = this.get('category');
logoUrl = category.get('logo_url'), const categoryUrl = Discourse.getURL('/c/') + Discourse.Category.slugFor(category);
categoryUrl = Discourse.getURL('/c/') + Discourse.Category.slugFor(category), const categoryName = Handlebars.Utils.escapeExpression(category.get('name'));
categoryName = Handlebars.Utils.escapeExpression(category.get('name'));
if (category.get('read_restricted')) { buffer.push("<i class='fa fa-lock'></i>"); } if (category.get('read_restricted')) { buffer.push(iconHTML('lock')); }
buffer.push("<a href='" + categoryUrl + "'>"); buffer.push(`<a href='${categoryUrl}'>`);
buffer.push("<span class='category-name'>" + categoryName + "</span>"); buffer.push(`<span class='category-name'>${categoryName}</span>`);
buffer.push(`</a>`);
if (!Em.isEmpty(logoUrl)) { buffer.push("<img src='" + logoUrl + "' class='category-logo'>"); }
buffer.push("</a>");
} }
}); });

View file

@ -13,34 +13,28 @@
<tr data-category_id='{{unbound c.id}}' {{bind-attr class="c.description_excerpt:has-description:no-description c.logo_url:has-logo:no-logo"}}> <tr data-category_id='{{unbound c.id}}' {{bind-attr class="c.description_excerpt:has-description:no-description c.logo_url:has-logo:no-logo"}}>
<td class='category' style={{border-color c.color}}> <td class='category' style={{border-color c.color}}>
<div> <div>
<div class="pull-left"> {{category-title-link category=c}}
{{category-title-link category=c}} {{category-unread category=c}}
{{#unless c.logo_url}} {{#if c.logo_url}}
{{category-unread category=c}} <img class="category-logo" src={{c.logo_url}}>
{{/unless}} {{/if}}
</div>
<div class="clearfix"></div>
</div>
{{#if c.description_excerpt}}
<div class="category-description"> <div class="category-description">
{{{c.description_excerpt}}} {{{c.description_excerpt}}}
</div> </div>
<div class="clearfix"></div>
{{#if c.logo_url}} </div>
{{category-unread category=c}}
{{/if}}
{{/if}}
{{#if c.subcategories}} {{#if c.subcategories}}
<div class='subcategories'> <div class='subcategories'>
{{#each s in c.subcategories}} {{#each c.subcategories as |s|}}
{{category-link s hideParent="true"}} {{category-link s hideParent="true"}}
{{category-unread category=s}} {{category-unread category=s}}
{{/each}} {{/each}}
</div> </div>
{{/if}} {{/if}}
</td> </td>
<td {{bind-attr class="c.archived :latest"}}> <td class="{{if c.archived 'archived'}} latest">
{{#each f in c.featuredTopics}} {{#each c.featuredTopics as |f|}}
{{featured-topic topic=f latestTopicOnly=latestTopicOnly action="showTopicEntrance"}} {{featured-topic topic=f latestTopicOnly=latestTopicOnly action="showTopicEntrance"}}
{{/each}} {{/each}}
</td> </td>