Sha256: e3ed3981a2290125c94735a66dfefbf22cdddf5af3c2eeaeff4846cda7e84073
Contents?: true
Size: 1.68 KB
Versions: 11
Compression:
Stored size: 1.68 KB
Contents
$(document).ready -> return unless $("form#lab_data_search") LabSearch = {} LabSearch.form = $("form#lab_data_search") ###### override this method to handle before send call yourself ######## LabSearch.BeforeSendHandler = (form)-> form.find('.error_message').html('') zip_code = form.find('#zip_code').val() if (!zip_code.match(/\d{5}/)) form.find('.error_message').html("Zip code should be 5 digits") false else form.find('#find_labs').prop("disabled", true) $('.lab_search_spinner_elem').show() true ###### override this method to handle success call yourself ######## LabSearch.SuccessHandler = (form, event, data)-> window.map_view.center_point = data.zip_location window.lab_list.setList(data.labs) # set the first lab as selected $('input:radio[name=selected_lab]:first').prop('checked',true) ###### handle ajax lab data search ######## $("form#lab_data_search") .bind('ajax:beforeSend', (event, data)-> LabSearch.BeforeSendHandler($(this)) ) .bind('ajax:success', (event, data)-> LabSearch.SuccessHandler($(this), event, data) ) .bind('ajax:complete', (event, data)-> form = $(this) $('.lab_search_spinner_elem').hide() # reenable to submit buttom form.find('#find_labs').prop("disabled", false) ) ###### handle toggle to show more labs ######## $("#more_labs_list_toggler").live("click", -> window.lab_list.setShowNumber(window.max_lab_show_number) # set the first lab as selected $('input:radio[name=selected_lab]:first').prop('checked',true) # hide the toggle to show more after they have been shown $("#more_labs_list_toggler").hide() )
Version data entries
11 entries across 11 versions & 1 rubygems