diff --git a/app/assets/javascripts/discourse/views/combobox_view.js b/app/assets/javascripts/discourse/views/combobox_view.js index 55468b13a..0ca43f4ee 100644 --- a/app/assets/javascripts/discourse/views/combobox_view.js +++ b/app/assets/javascripts/discourse/views/combobox_view.js @@ -42,6 +42,18 @@ Discourse.ComboboxView = Discourse.View.extend({ _this = this; $elem = this.$(); $elem.chosen({ template: this.template, disable_search_threshold: 5 }); + if (this.overrideWidths) { + // The Chosen plugin hard-codes the widths in style attrs. :< + $elem.chosen().next().removeAttr("style"); + $elem.chosen().next().find('.chzn-drop').removeAttr("style"); + $elem.chosen().next().find('.chzn-search input').removeAttr("style"); + } + if (this.classNames && this.classNames.length > 0) { + // Apply the classes to Chosen's dropdown div too: + this.classNames.each( function(c) { + $elem.chosen().next().addClass(c); + }); + } $elem.change(function(e) { _this.set('value', $(e.target).val()); }); diff --git a/app/assets/javascripts/discourse/views/combobox_view_category.js b/app/assets/javascripts/discourse/views/combobox_view_category.js index 2559725cd..ff82da6e1 100644 --- a/app/assets/javascripts/discourse/views/combobox_view_category.js +++ b/app/assets/javascripts/discourse/views/combobox_view_category.js @@ -8,6 +8,8 @@ **/ Discourse.ComboboxViewCategory = Discourse.ComboboxView.extend({ none: 'category.none', + classNames: ['combobox category-combobox'], + overrideWidths: true, dataAttributes: ['color', 'text_color', 'description'], valueBinding: Ember.Binding.oneWay('source'), @@ -15,11 +17,11 @@ Discourse.ComboboxViewCategory = Discourse.ComboboxView.extend({ if (!templateData.color) return text; var result = "" + text + ""; if (templateData.description && templateData.description !== 'null') { - result += "title=\"" + templateData.description + "\" "; + result += '