mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 19:14:01 +08:00
Add topic counts to category selector
This commit is contained in:
parent
91b9479986
commit
ee43ce693f
|
@ -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'>× " + templateData.topic_count + "</span>";
|
||||
if (templateData.description && templateData.description !== 'null') {
|
||||
result += '<div class="category-desc">' + Handlebars.Utils.escapeExpression(templateData.description) + '</div>';
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
vertical-align: top;
|
||||
}
|
||||
}
|
||||
.badge-category {
|
||||
h1 > .badge-category {
|
||||
margin-top: 5px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user