Skip to content
Browse files

rtl support for prototype based chosen

  • Loading branch information...
1 parent f5ac459 commit bd5daff469436c7df98e3c48fe978474e01e5be2 @aziz aziz committed Jul 31, 2011
Showing with 4 additions and 2 deletions.
  1. +2 −1 chosen/chosen.proto.js
  2. +2 −1 coffee/chosen.proto.coffee
View
3 chosen/chosen.proto.js
@@ -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
3 coffee/chosen.proto.coffee
@@ -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

0 comments on commit bd5daff

Please sign in to comment.
Something went wrong with that request. Please try again.