Sha256: 263045ecb0c8499617118fa9fe576c54723ed29a2fcb98aae567ca0dfa87bfe5

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

$(document).ready ->

  ###### handle ajax lab data search ########
  $("form#lab_data_search")
    .bind('ajax:beforeSend', (event, data)->
      zip_code = $(this).find('#zip_code').val()
      if (!zip_code.match(/\d{5}/))
        span = $('<span>Zip code should be 5 digits</span>')
        $('form#lab_data_search .error_message').append(span)
        span.fadeOut(4000)
        false
      $('.lab_search_spinner_elem').show()
    )
    .bind('ajax:success', (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)
      $('form#lab_data_search input[type=submit]').prop("disabled", false)
    )
    .bind('ajax:complete', (event, data)->
      $('.lab_search_spinner_elem').hide()
    )

  ###### 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

2 entries across 2 versions & 1 rubygems

Version Path
medivo-0.2.11 app/assets/javascripts/medivo/lab_list/handlers.coffee
medivo-0.2.10 app/assets/javascripts/medivo/lab_list/handlers.coffee