Skip to content
New issue

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

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

Already on GitHub? # to your account

Make choices_click() method more readable. #1163

Merged
merged 3 commits into from
Apr 25, 2013
Merged
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
2 changes: 1 addition & 1 deletion chosen/chosen.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ Copyright (c) 2011 by Harvest

Chosen.prototype.choices_click = function(evt) {
evt.preventDefault();
if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) {
if (!this.results_showing) {
return this.results_show();
}
};
Expand Down
2 changes: 1 addition & 1 deletion chosen/chosen.jquery.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion chosen/chosen.proto.js
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ Copyright (c) 2011 by Harvest

Chosen.prototype.choices_click = function(evt) {
evt.preventDefault();
if (this.active_field && !(evt.target.hasClassName('search-choice') || evt.target.up('.search-choice')) && !this.results_showing) {
if (!this.results_showing) {
return this.results_show();
}
};
Expand Down
2 changes: 1 addition & 1 deletion chosen/chosen.proto.min.js

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions coffee/chosen.jquery.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,9 @@ class Chosen extends AbstractChosen
search_results_mouseout: (evt) ->
this.result_clear_highlight() if $(evt.target).hasClass "active-result" or $(evt.target).parents('.active-result').first()


choices_click: (evt) ->
evt.preventDefault()
if( @active_field and not($(evt.target).hasClass "search-choice" or $(evt.target).parents('.search-choice').first) and not @results_showing )
this.results_show()
this.results_show() unless @results_showing
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as it is now the same in both versions, it could be moved to AbstractChosen

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. I'll do that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a small enough change. I committed straight to master: 9969a46


choice_build: (item) ->
if @is_multiple and @max_selected_options <= @choices
Expand Down
4 changes: 1 addition & 3 deletions coffee/chosen.proto.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,9 @@ class Chosen extends AbstractChosen
search_results_mouseout: (evt) ->
this.result_clear_highlight() if evt.target.hasClassName('active-result') or evt.target.up('.active-result')


choices_click: (evt) ->
evt.preventDefault()
if( @active_field and not(evt.target.hasClassName('search-choice') or evt.target.up('.search-choice')) and not @results_showing )
this.results_show()
this.results_show() unless @results_showing

choice_build: (item) ->
if @is_multiple and @max_selected_options <= @choices
Expand Down