Sha256: 132f5a5d573b58ff2bfc538edb536ad5ae6265d9c7a0a87c5afaa88d622b4d5d

Contents?: true

Size: 993 Bytes

Versions: 1

Compression:

Stored size: 993 Bytes

Contents

$(document).ready ->

  map_view  = null
  lab_list = null
  data = $('#lab_list_container').data('labs')
  if data
    lab_list = new window.LabList( data.labs )
    map_view = new window.MapView( lab_list, data.zip_location )
    lab_list_view = new window.LabListView( lab_list )
    map_view.render()
  else
    console.log('no data')

  ###### 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
    )
    .bind('ajax:success', (event, data)->
      lab_list.setLabs(data.labs)
      map_view.center_point = data.zip_location
      map_view.render()
      $('form#lab_data_search input[type=submit]').prop("disabled", false)
    )
    .bind('ajax:complete', (event, data)->
    )

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
medivo-0.0.2 app/assets/javascripts/medivo/show_labs.coffee