Fix for when category description has html. Could be better.

This commit is contained in:
Neil Lalonde 2013-04-04 17:16:30 -04:00
parent d974aea536
commit bd0e98aec2
1 changed files with 3 additions and 4 deletions

View File

@ -10,16 +10,15 @@ Discourse.ComboboxViewCategory = Discourse.ComboboxView.extend({
none: 'category.none', none: 'category.none',
classNames: ['combobox category-combobox'], classNames: ['combobox category-combobox'],
overrideWidths: true, overrideWidths: true,
dataAttributes: ['color', 'text_color', 'description'], dataAttributes: ['name', 'color', 'text_color', 'description'],
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 + ";' >" + text + "</span>"; templateData.text_color + ";'>" + templateData.name + "</span>";
if (templateData.description && templateData.description !== 'null') { if (templateData.description && templateData.description !== 'null') {
result += '<div class="category-desc">' + templateData.description + '</div>'; result += '<div class="category-desc">' + Handlebars.Utils.escapeExpression(templateData.description) + '</div>';
} }
return result; return result;
} }