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({
tagName: 'h3',
render: function(buffer) {
var category = this.get('category'),
logoUrl = category.get('logo_url'),
categoryUrl = Discourse.getURL('/c/') + Discourse.Category.slugFor(category),
categoryName = Handlebars.Utils.escapeExpression(category.get('name'));
render(buffer) {
const category = this.get('category');
const categoryUrl = Discourse.getURL('/c/') + Discourse.Category.slugFor(category);
const 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("<span class='category-name'>" + categoryName + "</span>");
if (!Em.isEmpty(logoUrl)) { buffer.push("<img src='" + logoUrl + "' class='category-logo'>"); }
buffer.push("</a>");
buffer.push(`<a href='${categoryUrl}'>`);
buffer.push(`<span class='category-name'>${categoryName}</span>`);
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"}}>
<td class='category' style={{border-color c.color}}>
<div>
<div class="pull-left">
{{category-title-link category=c}}
{{#unless c.logo_url}}
{{category-unread category=c}}
{{/unless}}
</div>
<div class="clearfix"></div>
</div>
{{#if c.description_excerpt}}
{{category-title-link category=c}}
{{category-unread category=c}}
{{#if c.logo_url}}
<img class="category-logo" src={{c.logo_url}}>
{{/if}}
<div class="category-description">
{{{c.description_excerpt}}}
</div>
{{#if c.logo_url}}
{{category-unread category=c}}
{{/if}}
{{/if}}
<div class="clearfix"></div>
</div>
{{#if c.subcategories}}
<div class='subcategories'>
{{#each s in c.subcategories}}
{{#each c.subcategories as |s|}}
{{category-link s hideParent="true"}}
{{category-unread category=s}}
{{/each}}
</div>
{{/if}}
</td>
<td {{bind-attr class="c.archived :latest"}}>
{{#each f in c.featuredTopics}}
<td class="{{if c.archived 'archived'}} latest">
{{#each c.featuredTopics as |f|}}
{{featured-topic topic=f latestTopicOnly=latestTopicOnly action="showTopicEntrance"}}
{{/each}}
</td>