rtl support for prototype based chosen

abstract-chosen
Allen Bargi 2011-07-31 13:12:29 +02:00
parent f5ac459d7c
commit bd5daff469
2 changed files with 4 additions and 2 deletions

View File

@ -14,6 +14,7 @@
this.set_default_values();
this.form_field = elmn;
this.is_multiple = this.form_field.multiple;
this.is_rtl = this.form_field.hasClassName("chzn-rtl");
this.default_text_default = this.form_field.multiple ? "Select Some Options" : "Select an Option";
this.set_up_html();
this.register_observers();
@ -39,7 +40,7 @@
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',
'class': "chzn-container " + (this.is_rtl ? ' chzn-rtl' : void 0),
'style': 'width: ' + this.f_width + 'px'
};
this.default_text = this.form_field.readAttribute('data-placeholder') ? this.form_field.readAttribute('data-placeholder') : this.default_text_default;

View File

@ -16,6 +16,7 @@ class Chosen
@form_field = elmn
@is_multiple = @form_field.multiple
@is_rtl = @form_field.hasClassName "chzn-rtl"
@default_text_default = if @form_field.multiple then "Select Some Options" else "Select an Option"
@ -47,7 +48,7 @@ class Chosen
container_props =
'id': @container_id
'class': 'chzn-container'
'class': "chzn-container #{' chzn-rtl' if @is_rtl}"
'style': 'width: ' + (@f_width) + 'px' #use parens around @f_width so coffeescript doesn't think + ' px' is a function parameter
@default_text = if @form_field.readAttribute 'data-placeholder' then @form_field.readAttribute 'data-placeholder' else @default_text_default