Add 'descrption' to categories, even when in a Combobox
This commit is contained in:
parent
0e087e040f
commit
6c30e0b09c
|
@ -10,7 +10,7 @@
|
|||
{{/if}}
|
||||
{{#if view.editingTopic}}
|
||||
<input id='edit-title' type='text' {{bindAttr value="view.topic.title"}}>
|
||||
{{view Discourse.ComboboxViewCategory valueAttribute="name" contentBinding="view.categories" valueBinding="view.topic.categoryName"}}
|
||||
{{view Discourse.ComboboxViewCategory valueAttribute="name" contentBinding="Discourse.site.categories" valueBinding="view.topic.categoryName"}}
|
||||
<button class='btn btn-primary btn-small' {{action finishedEdit target="view"}}><i class='icon-ok'></i></button>
|
||||
<button class='btn btn-small' {{action cancelEdit target="view"}}><i class='icon-remove'></i></button>
|
||||
{{else}}
|
||||
|
|
|
@ -8,11 +8,16 @@
|
|||
**/
|
||||
Discourse.ComboboxViewCategory = Discourse.ComboboxView.extend({
|
||||
none: 'category.none',
|
||||
dataAttributes: ['color'],
|
||||
dataAttributes: ['color', 'description'],
|
||||
|
||||
template: function(text, templateData) {
|
||||
if (!templateData.color) return text;
|
||||
return "<span class='badge-category' style='background-color: #" + templateData.color + "'>" + text + "</span>";
|
||||
|
||||
var result = "<span class='badge-category' style='background-color: #" + templateData.color + "' "
|
||||
if (templateData.description && templateData.description != 'null') {
|
||||
result += "title=\"" + templateData.description + "\" ";
|
||||
}
|
||||
return result + ">" + text + "</span>";
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -13,7 +13,6 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
|||
userFiltersBinding: 'controller.userFilters',
|
||||
classNameBindings: ['controller.multiSelect:multi-select', 'topic.archetype'],
|
||||
siteBinding: 'Discourse.site',
|
||||
categoriesBinding: 'site.categories',
|
||||
progressPosition: 1,
|
||||
menuVisible: true,
|
||||
SHORT_POST: 1200,
|
||||
|
|
Loading…
Reference in New Issue