Permalink
Browse files

Merge branch 'master' into change-search-split-variable-language

Conflicts:
	chosen/chosen.jquery.min.js
	chosen/chosen.proto.min.js
  • Loading branch information...
2 parents b740df5 + dc66716 commit 2a9674e87a552874cdbf38ad23dfc9b61746820e @pfiller pfiller committed Dec 12, 2012
View
@@ -137,7 +137,8 @@ Copyright (c) 2011 by Harvest
this.search_contains = this.options.search_contains || false;
this.choices = 0;
this.single_backstroke_delete = this.options.single_backstroke_delete || false;
- return this.max_selected_options = this.options.max_selected_options || Infinity;
+ this.max_selected_options = this.options.max_selected_options || Infinity;
+ return this.inherit_select_classes = this.options.inherit_select_classes || false;
};
AbstractChosen.prototype.set_default_text = function() {
@@ -337,13 +338,21 @@ Copyright (c) 2011 by Harvest
};
Chosen.prototype.set_up_html = function() {
- var container_div, container_props, dd_top, dd_width, sf_width;
+ var container_classes, container_div, container_props, dd_top, dd_width, sf_width;
this.container_id = this.form_field.id.length ? this.form_field.id.replace(/[^\w]/g, '_') : this.generate_field_id();
this.container_id += "_chzn";
+ container_classes = ["chzn-container"];
+ container_classes.push("chzn-container-" + (this.is_multiple ? "multi" : "single"));
+ if (this.inherit_select_classes && this.form_field.className) {
+ container_classes.push(this.form_field.className);
+ }
+ if (this.is_rtl) {
+ container_classes.push("chzn-rtl");
+ }
this.f_width = this.form_field_jq.outerWidth();
container_props = {
id: this.container_id,
- "class": "chzn-container" + (this.is_rtl ? ' chzn-rtl' : ''),
+ "class": container_classes.join(' '),
style: 'width: ' + this.f_width + 'px;',
title: this.form_field.title
};
@@ -355,7 +364,6 @@ Copyright (c) 2011 by Harvest
}
this.form_field_jq.hide().after(container_div);
this.container = $('#' + this.container_id);
- this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single"));
this.dropdown = this.container.find('div.chzn-drop').first();
dd_top = this.container.height();
dd_width = this.f_width - get_side_border_padding(this.dropdown);

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -137,7 +137,8 @@ Copyright (c) 2011 by Harvest
this.search_contains = this.options.search_contains || false;
this.choices = 0;
this.single_backstroke_delete = this.options.single_backstroke_delete || false;
- return this.max_selected_options = this.options.max_selected_options || Infinity;
+ this.max_selected_options = this.options.max_selected_options || Infinity;
+ return this.inherit_select_classes = this.options.inherit_select_classes || false;
};
AbstractChosen.prototype.set_default_text = function() {
@@ -328,12 +329,20 @@ Copyright (c) 2011 by Harvest
};
Chosen.prototype.set_up_html = function() {
- var base_template, container_props, dd_top, dd_width, sf_width;
+ var base_template, container_classes, container_props, dd_top, dd_width, sf_width;
this.container_id = this.form_field.identify().replace(/[^\w]/g, '_') + "_chzn";
+ container_classes = ["chzn-container"];
+ container_classes.push("chzn-container-" + (this.is_multiple ? "multi" : "single"));
+ if (this.inherit_select_classes && this.form_field.className) {
+ container_classes.push(this.form_field.className);
+ }
+ if (this.is_rtl) {
+ container_classes.push("chzn-rtl");
+ }
this.f_width = this.form_field.getStyle("width") ? parseInt(this.form_field.getStyle("width"), 10) : this.form_field.getWidth();
container_props = {
'id': this.container_id,
- 'class': "chzn-container" + (this.is_rtl ? ' chzn-rtl' : ''),
+ 'class': container_classes.join(' '),
'style': 'width: ' + this.f_width + 'px',
'title': this.form_field.title
};
@@ -346,7 +355,6 @@ Copyright (c) 2011 by Harvest
after: base_template
});
this.container = $(this.container_id);
- this.container.addClassName("chzn-container-" + (this.is_multiple ? "multi" : "single"));
this.dropdown = this.container.down('div.chzn-drop');
dd_top = this.container.getHeight();
dd_width = this.f_width - get_side_border_padding(this.dropdown);

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -30,11 +30,16 @@ class Chosen extends AbstractChosen
@container_id = if @form_field.id.length then @form_field.id.replace(/[^\w]/g, '_') else this.generate_field_id()
@container_id += "_chzn"
+ container_classes = ["chzn-container"]
+ container_classes.push "chzn-container-" + (if @is_multiple then "multi" else "single")
+ container_classes.push @form_field.className if @inherit_select_classes && @form_field.className
+ container_classes.push "chzn-rtl" if @is_rtl
+
@f_width = @form_field_jq.outerWidth()
container_props =
id: @container_id
- class: "chzn-container#{ if @is_rtl then ' chzn-rtl' else '' }"
+ class: container_classes.join ' '
style: 'width: ' + (@f_width) + 'px;' #use parens around @f_width so coffeescript doesn't think + ' px' is a function parameter
title: @form_field.title
@@ -47,7 +52,6 @@ class Chosen extends AbstractChosen
@form_field_jq.hide().after container_div
@container = ($ '#' + @container_id)
- @container.addClass( "chzn-container-" + (if @is_multiple then "multi" else "single") )
@dropdown = @container.find('div.chzn-drop').first()
dd_top = @container.height()
@@ -26,19 +26,23 @@ class Chosen extends AbstractChosen
set_up_html: ->
@container_id = @form_field.identify().replace(/[^\w]/g, '_') + "_chzn"
+ container_classes = ["chzn-container"]
+ container_classes.push "chzn-container-" + (if @is_multiple then "multi" else "single")
+ container_classes.push @form_field.className if @inherit_select_classes && @form_field.className
+ container_classes.push "chzn-rtl" if @is_rtl
+
@f_width = if @form_field.getStyle("width") then parseInt @form_field.getStyle("width"), 10 else @form_field.getWidth()
container_props =
'id': @container_id
- 'class': "chzn-container#{ if @is_rtl then ' chzn-rtl' else '' }"
+ 'class': container_classes.join ' '
'style': 'width: ' + (@f_width) + 'px' #use parens around @f_width so coffeescript doesn't think + ' px' is a function parameter
'title': @form_field.title
base_template = if @is_multiple then new Element('div', container_props).update( @multi_temp.evaluate({ "default": @default_text}) ) else new Element('div', container_props).update( @single_temp.evaluate({ "default":@default_text }) )
@form_field.hide().insert({ after: base_template })
@container = $(@container_id)
- @container.addClassName( "chzn-container-" + (if @is_multiple then "multi" else "single") )
@dropdown = @container.down('div.chzn-drop')
dd_top = @container.getHeight()
@@ -34,6 +34,7 @@ class AbstractChosen
@choices = 0
@single_backstroke_delete = @options.single_backstroke_delete || false
@max_selected_options = @options.max_selected_options || Infinity
+ @inherit_select_classes = @options.inherit_select_classes || false
set_default_text: ->
if @form_field.getAttribute("data-placeholder")

0 comments on commit 2a9674e

Please sign in to comment.