Add topic counts to category selector

This commit is contained in:
Neil Lalonde 2013-04-05 15:43:56 -04:00
parent 91b9479986
commit ee43ce693f
3 changed files with 10 additions and 2 deletions

View File

@ -10,13 +10,14 @@ Discourse.ComboboxViewCategory = Discourse.ComboboxView.extend({
none: 'category.none',
classNames: ['combobox category-combobox'],
overrideWidths: true,
dataAttributes: ['name', 'color', 'text_color', 'description'],
dataAttributes: ['name', 'color', 'text_color', 'description', 'topic_count'],
valueBinding: Ember.Binding.oneWay('source'),
template: function(text, templateData) {
if (!templateData.color) return text;
var result = "<span class='badge-category' style='background-color: #" + templateData.color + '; color: #' +
templateData.text_color + ";'>" + templateData.name + "</span>";
result += " <span class='topic-count'>&times; " + templateData.topic_count + "</span>";
if (templateData.description && templateData.description !== 'null') {
result += '<div class="category-desc">' + Handlebars.Utils.escapeExpression(templateData.description) + '</div>';
}

View File

@ -1,4 +1,11 @@
.category-combobox {
.topic-count {
font-size: 11px;
color: #666;
}
.highlighted .topic-count {
color: white;
}
.category-desc {
margin: 6px 0px 0px 3px;
font-size: 12px;

View File

@ -48,7 +48,7 @@
vertical-align: top;
}
}
.badge-category {
h1 > .badge-category {
margin-top: 5px;
vertical-align: top;
}