Add 'descrption' to categories, even when in a Combobox

This commit is contained in:
Robin Ward 2013-02-26 12:17:23 -05:00
parent 0e087e040f
commit 6c30e0b09c
3 changed files with 8 additions and 4 deletions

View file

@ -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}}

View file

@ -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>";
}
});

View file

@ -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,