Skip to content

Commit

Permalink
Yes! A second click on the dropdown arrow _should_ collapse the dropd…
Browse files Browse the repository at this point in the history
…own box.

Closes gh-1
  • Loading branch information
pfiller committed Jul 18, 2011
1 parent 137afac commit ed9e82a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
9 changes: 8 additions & 1 deletion chosen/chosen.jquery.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion chosen/chosen.proto.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion coffee/chosen.jquery.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class Chosen
this.results_show()
else if not @is_multiple and evt and ($(evt.target) is @selected_item || $(evt.target).parents("a.chzn-single").length)
evt.preventDefault()
this.results_show()
this.results_toggle()

this.activate_field()
else
Expand Down Expand Up @@ -248,6 +248,12 @@ class Chosen
@result_highlight.removeClass "highlighted" if @result_highlight
@result_highlight = null

results_toggle: ->
if @results_showing
this.results_hide()
else
this.results_show()

results_show: ->
if not @is_multiple
@selected_item.addClass "chzn-single-with-drop"
Expand Down
8 changes: 7 additions & 1 deletion coffee/chosen.proto.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class Chosen
document.observe "click", @click_test_action
this.results_show()
else if not @is_multiple and evt and (evt.target is @selected_item || evt.target.up("a.chzn-single"))
this.results_show()
this.results_toggle()

this.activate_field()
else
Expand Down Expand Up @@ -242,6 +242,12 @@ class Chosen
@result_highlight.removeClassName('highlighted') if @result_highlight
@result_highlight = null

results_toggle: ->
if @results_showing
this.results_hide()
else
this.results_show()

results_show: ->
if not @is_multiple
@selected_item.addClassName('chzn-single-with-drop')
Expand Down

0 comments on commit ed9e82a

Please sign in to comment.