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() )