Sha256: f0ba6f6e2664660ff11432aaab22ae770d32bdfe7e30339fb24c4b5465157b9a

Contents?: true

Size: 905 Bytes

Versions: 1

Compression:

Stored size: 905 Bytes

Contents

class window.Lab
  constructor: (@data)->
  marker: null
  map_tooltip_template: Handlebars.compile("{{name}}\n{{address}}\n{{city}},{{state}} ")

  clearMarker: ->
    if this.marker
      this.marker.setMap(null)
      this.marker = null

  setMarker: (map, markerBounds)->
    this.point = new google.maps.LatLng(@data.lat, @data.lng)
    this.marker = this.makeMarker(map)
    if markerBounds
      markerBounds.extend(this.point)

  makeMarker: (map)->
    new google.maps.Marker({
      position: this.point
      map: map
      title: this.map_tooltip_template(@data)
      icon: this.makeIcon()
    })

  makeIcon: ->
    new google.maps.MarkerImage("/assets/medivo/lab.png")


class window.LabList

  constructor: (@data)->
    labs = @labs = []
    $.each( @data, (index, lab_data)->
      labs.push(new Lab(lab_data))
    )

  clearMarkers: -> $.each( @labs, (index, lab)-> lab.clearMarker() )

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
medivo-0.0.1 app/assets/javascripts/medivo/models.coffee