Merge branch 'search_improvements' into harvest_experimental

Conflicts:
	chosen/chosen.jquery.min.js
	chosen/chosen.proto.min.js
harvest_experimental
Patrick Filler 2012-02-28 10:54:33 -05:00
commit cd93d92e85
7 changed files with 47 additions and 39 deletions

View File

@ -127,6 +127,7 @@ Copyright (c) 2011 by Harvest
this.results_showing = false;
this.result_highlighted = null;
this.result_single_selected = null;
this.enable_group_select = this.options.enable_group_select || false;
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
this.disable_search_threshold = this.options.disable_search_threshold || 0;
this.enable_select_all = (this.options.enable_select_all != null) && this.is_multiple ? this.options.enable_select_all : false;
@ -672,6 +673,7 @@ Copyright (c) 2011 by Harvest
Chosen.prototype.search_results_mouseup = function(evt) {
var child, children, group, option, _i, _len;
if (this.enable_group_select) {
group = $(evt.target).hasClass("group-result") ? $(evt.target) : $(evt.target).parents(".group-result").first();
if (group.length) {
children = group.nextUntil(".group-result", ".active-result");
@ -683,6 +685,7 @@ Copyright (c) 2011 by Harvest
});
}
}
}
option = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
if (option.length) {
this.result_highlight = option;

File diff suppressed because one or more lines are too long

View File

@ -127,6 +127,7 @@ Copyright (c) 2011 by Harvest
this.results_showing = false;
this.result_highlighted = null;
this.result_single_selected = null;
this.enable_group_select = this.options.enable_group_select || false;
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
this.disable_search_threshold = this.options.disable_search_threshold || 0;
this.enable_select_all = (this.options.enable_select_all != null) && this.is_multiple ? this.options.enable_select_all : false;
@ -662,6 +663,7 @@ Copyright (c) 2011 by Harvest
Chosen.prototype.search_results_mouseup = function(evt) {
var child, group, option, possible_children, _i, _len;
if (this.enable_group_select) {
group = evt.target.hasClassName("group-result") ? evt.target : evt.target.up(".group-result");
if (group) {
possible_children = group.nextSiblings();
@ -677,6 +679,7 @@ Copyright (c) 2011 by Harvest
}
}
}
}
option = evt.target.hasClassName("active-result") ? evt.target : evt.target.up(".active-result");
if (option) {
this.result_highlight = option;

File diff suppressed because one or more lines are too long

View File

@ -300,6 +300,7 @@ class Chosen extends AbstractChosen
@search_field.removeClass "default"
search_results_mouseup: (evt) ->
if @enable_group_select
group = if $(evt.target).hasClass "group-result" then $(evt.target) else $(evt.target).parents(".group-result").first()
if group.length
children = group.nextUntil(".group-result", ".active-result")

View File

@ -289,7 +289,7 @@ class Chosen extends AbstractChosen
@search_field.removeClassName "default"
search_results_mouseup: (evt) ->
if @enable_group_select
group = if evt.target.hasClassName("group-result") then evt.target else evt.target.up(".group-result")
if group
possible_children = group.nextSiblings()

View File

@ -27,6 +27,7 @@ class AbstractChosen
@results_showing = false
@result_highlighted = null
@result_single_selected = null
@enable_group_select = @options.enable_group_select || 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
@enable_select_all = if @options.enable_select_all? and @is_multiple then @options.enable_select_all else false