Skip to content

Commit

Permalink
added rtl as initializer option, fixes harvesthq#1485
Browse files Browse the repository at this point in the history
  • Loading branch information
koenpunt committed Aug 20, 2013
1 parent 5eac8bc commit cb8e3cb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion coffee/chosen.jquery.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Chosen extends AbstractChosen
setup: ->
@form_field_jq = $ @form_field
@current_selectedIndex = @form_field.selectedIndex
@is_rtl = @form_field_jq.hasClass "chosen-rtl"
@is_rtl = true if @form_field_jq.hasClass "chosen-rtl"

set_up_html: ->
container_classes = ["chosen-container"]
Expand Down
2 changes: 1 addition & 1 deletion coffee/chosen.proto.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class @Chosen extends AbstractChosen

setup: ->
@current_selectedIndex = @form_field.selectedIndex
@is_rtl = @form_field.hasClassName "chosen-rtl"
@is_rtl = true if @form_field.hasClassName "chosen-rtl"

set_default_values: ->
super()
Expand Down
1 change: 1 addition & 0 deletions coffee/lib/abstract-chosen.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class AbstractChosen
@mouse_on_container = false
@results_showing = false
@result_highlighted = null
@is_rtl = @options.rtl || false
@allow_single_deselect = if @options.allow_single_deselect? and @form_field.options[0]? and @form_field.options[0].text is "" then @options.allow_single_deselect else false
@disable_search_threshold = @options.disable_search_threshold || 0
@disable_search = @options.disable_search || false
Expand Down
8 changes: 8 additions & 0 deletions public/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ <h3>Example:</h3>
<p><strong>Note:</strong> this is for multiple selects only. In single selects, the selected result will always be displayed.</p>
</td>
</tr>
<tr>
<td>rtl</td>
<td>false</td>
<td>
<p>Chosen supports right-to-left text in select boxes. Set this option to <code class="language-javascript">true</code> to support right-to-left text options.</p>
<p><strong>Note:</strong> the <code class="language-javascript">chosen-rtl</code> class on the select has precedence over this option.</p>
</td>
</tr>
</table>

<h2><a name="attributes" class="anchor" href="#attributes">Attributes</a></h2>
Expand Down

0 comments on commit cb8e3cb

Please sign in to comment.