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