FIX: semantic HTML for category with images

This commit is contained in:
Régis Hanol 2014-12-15 15:39:13 +01:00
parent ed54ea6642
commit a014507da4
2 changed files with 13 additions and 10 deletions

View File

@ -3,19 +3,17 @@ export default Em.Component.extend({
render: function(buffer) {
var category = this.get('category'),
logoUrl = category.get('logo_url');
logoUrl = category.get('logo_url'),
categoryUrl = Discourse.getURL('/c/') + Discourse.Category.slugFor(category),
categoryName = Handlebars.Utils.escapeExpression(category.get('name'));
if (category.get('read_restricted')) {
buffer.push("<i class='fa fa-group'></i> ");
}
if (category.get('read_restricted')) { buffer.push("<i class='fa fa-group'></i>"); }
buffer.push("<a href='" + Discourse.getURL('/c/') + Discourse.Category.slugFor(category) + "'>");
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'>"); }
var noLogo = Em.isEmpty(logoUrl);
buffer.push(Handlebars.Utils.escapeExpression(category.get('name')));
if (!noLogo) {
buffer.push("<br><img src='" + logoUrl + "' class='category-logo'>");
}
buffer.push("</a>");
}
});

View File

@ -312,6 +312,11 @@ button.dismiss-read {
font-size: 1.5em;
}
}
.category-name {
display: block;
}
.category-logo {
max-height: 150px;
float: left;