Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: rtl as initializer option #1491

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion coffee/chosen.jquery.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class Chosen extends AbstractChosen
setup: ->
@form_field_jq = $ @form_field
@current_selectedIndex = @form_field.selectedIndex
@is_rtl = @form_field_jq.hasClass "chosen-rtl"

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

setup: ->
@current_selectedIndex = @form_field.selectedIndex
@is_rtl = @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 || /\bchosen-rtl\b/.test(@form_field.className) || 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