mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-04-28 06:54:06 -04:00
Add topic counts to category selector
This commit is contained in:
parent
91b9479986
commit
ee43ce693f
3 changed files with 10 additions and 2 deletions
app/assets
javascripts/discourse/views
stylesheets/application
|
@ -10,13 +10,14 @@ Discourse.ComboboxViewCategory = Discourse.ComboboxView.extend({
|
||||||
none: 'category.none',
|
none: 'category.none',
|
||||||
classNames: ['combobox category-combobox'],
|
classNames: ['combobox category-combobox'],
|
||||||
overrideWidths: true,
|
overrideWidths: true,
|
||||||
dataAttributes: ['name', 'color', 'text_color', 'description'],
|
dataAttributes: ['name', 'color', 'text_color', 'description', 'topic_count'],
|
||||||
valueBinding: Ember.Binding.oneWay('source'),
|
valueBinding: Ember.Binding.oneWay('source'),
|
||||||
|
|
||||||
template: function(text, templateData) {
|
template: function(text, templateData) {
|
||||||
if (!templateData.color) return text;
|
if (!templateData.color) return text;
|
||||||
var result = "<span class='badge-category' style='background-color: #" + templateData.color + '; color: #' +
|
var result = "<span class='badge-category' style='background-color: #" + templateData.color + '; color: #' +
|
||||||
templateData.text_color + ";'>" + templateData.name + "</span>";
|
templateData.text_color + ";'>" + templateData.name + "</span>";
|
||||||
|
result += " <span class='topic-count'>× " + templateData.topic_count + "</span>";
|
||||||
if (templateData.description && templateData.description !== 'null') {
|
if (templateData.description && templateData.description !== 'null') {
|
||||||
result += '<div class="category-desc">' + Handlebars.Utils.escapeExpression(templateData.description) + '</div>';
|
result += '<div class="category-desc">' + Handlebars.Utils.escapeExpression(templateData.description) + '</div>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
.category-combobox {
|
.category-combobox {
|
||||||
|
.topic-count {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.highlighted .topic-count {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
.category-desc {
|
.category-desc {
|
||||||
margin: 6px 0px 0px 3px;
|
margin: 6px 0px 0px 3px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.badge-category {
|
h1 > .badge-category {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue