### Chosen source: generate output using 'cake build' Copyright (c) 2011 by Harvest ### root = this class AbstractChosen constructor: (elmn) -> this.set_default_values() @form_field = elmn @is_multiple = @form_field.multiple @default_text_default = if @is_multiple then "Select Some Options" else "Select an Option" this.setup() this.set_up_html() this.register_observers() this.finish_setup() set_default_values: -> @click_test_action = (evt) => this.test_active_click(evt) @active_field = false @mouse_on_container = false @results_showing = false @result_highlighted = null @result_single_selected = null @choices = 0 mouse_enter: -> @mouse_on_container = true mouse_leave: -> @mouse_on_container = false input_focus: (evt) -> setTimeout (=> this.container_mousedown()), 50 unless @active_field input_blur: (evt) -> if not @mouse_on_container @active_field = false setTimeout (=> this.blur_test()), 100 result_add_option: (option) -> if not option.disabled option.dom_id = @container_id + "_o_" + option.array_index classes = if option.selected and @is_multiple then [] else ["active-result"] classes.push "result-selected" if option.selected classes.push "group-option" if option.group_array_index? '