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 += '
' + templateData.description + '
'; } - return result + ">" + text + ""; + return result; } }); diff --git a/app/assets/javascripts/external/chosen.jquery.js b/app/assets/javascripts/external/chosen.jquery.js index 9ae0bac34..4abf8b78f 100644 --- a/app/assets/javascripts/external/chosen.jquery.js +++ b/app/assets/javascripts/external/chosen.jquery.js @@ -592,6 +592,10 @@ Copyright (c) 2011 by Harvest this.result_clear_highlight(); this.result_highlight = el; this.result_highlight.addClass("highlighted"); + /* + + The following code causes jumpy behaviour while scrolling, and I don't see what problem it solves: + maxHeight = parseInt(this.search_results.css("maxHeight"), 10); visible_top = this.search_results.scrollTop(); visible_bottom = maxHeight + visible_top; @@ -602,6 +606,7 @@ Copyright (c) 2011 by Harvest } else if (high_top < visible_top) { return this.search_results.scrollTop(high_top); } + */ } }; diff --git a/app/assets/stylesheets/application/compose.css.scss b/app/assets/stylesheets/application/compose.css.scss index 36d15f407..d31756369 100644 --- a/app/assets/stylesheets/application/compose.css.scss +++ b/app/assets/stylesheets/application/compose.css.scss @@ -230,6 +230,7 @@ min-width: 1280px; .form-element { .chzn-container { + width: 400px; margin-top: 6px; a { padding-top: 4px; @@ -239,6 +240,28 @@ margin-top: 4px; } } + .category-combobox { + .category-desc { + margin: 8px 8px 0px 8px; + font-size: 12px; + } + + width: 430px; + @include medium-width { width: 285px; } + @include small-width { width: 220px; } + + .chzn-drop { + left: -9000px; + width: 428px; + @include medium-width { width: 283px; } + @include small-width { width: 218px; } + } + .chzn-search input { + width: 398px; + @include medium-width { width: 253px; } + @include small-width { width: 188px; } + } + } } #reply-title { margin-right: 10px;