Yes! A second click on the dropdown arrow _should_ collapse the dropdown box.

Closes gh-1
abstract-chosen
Patrick Filler 2011-07-18 18:47:40 -04:00
parent 137afacfd1
commit ed9e82a816
4 changed files with 30 additions and 4 deletions

View File

@ -137,7 +137,7 @@
this.results_show();
} else if (!this.is_multiple && evt && ($(evt.target) === this.selected_item || $(evt.target).parents("a.chzn-single").length)) {
evt.preventDefault();
this.results_show();
this.results_toggle();
}
return this.activate_field();
} else {
@ -280,6 +280,13 @@
}
return this.result_highlight = null;
};
Chosen.prototype.results_toggle = function() {
if (this.results_showing) {
return this.results_hide();
} else {
return this.results_show();
}
};
Chosen.prototype.results_show = function() {
var dd_top;
if (!this.is_multiple) {

View File

@ -134,7 +134,7 @@
document.observe("click", this.click_test_action);
this.results_show();
} else if (!this.is_multiple && evt && (evt.target === this.selected_item || evt.target.up("a.chzn-single"))) {
this.results_show();
this.results_toggle();
}
return this.activate_field();
} else {
@ -275,6 +275,13 @@
}
return this.result_highlight = null;
};
Chosen.prototype.results_toggle = function() {
if (this.results_showing) {
return this.results_hide();
} else {
return this.results_show();
}
};
Chosen.prototype.results_show = function() {
var dd_top;
if (!this.is_multiple) {

View File

@ -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
@ -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"

View File

@ -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
@ -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')