Sha256: 8b9123c5b4f738bcdbc64a737a39b073f6e5d7d369616eefbf6d3e3d59ec64eb

Contents?: true

Size: 1.93 KB

Versions: 48

Compression:

Stored size: 1.93 KB

Contents

#= require medivo/models

##########  Lab model ##############
class window.Lab
  map_tooltip_template: Handlebars.compile("{{titleize name}}\n{{address_without_comma address}}\n{{titleize city}},{{state}} ")
  index = null
  marker = null
  point = null

  constructor: (@data) ->

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

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

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

  makeIcon: ->
    "/assets/medivo/lab.png"

  icon: ->
    return @marker.icon if @marker
    this.makeIcon()


##########  OrderedLab model ##############
class window.OrderedLab extends Lab
  constructor: (@data, index) -> @index = index

  makeIcon: ->
    super() unless window.isNumber(@index)
    "/assets/medivo/marker" + this.makeLetter(@index) + ".png"

  makeLetter: (number) ->
    if (number >= 0 && number <= 26)
      return String.fromCharCode(number + 65)
    return ''

  icon: ->
    return @marker.icon if @marker
    this.makeIcon(@index)


##########  LabList model ##############
class window.LabList extends List

  constructor: (lab_info, show_number, model, tracker_id)->
    model = Lab unless model
    tracker_id = 'lab_list_tracker' unless tracker_id
    super( lab_info, show_number, model, tracker_id)

  # use this method to set new lab info
  setList: (lab_info)->
    this.clearMarkers()
    super(lab_info)

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


##########  OrderedLabList model ##############
class window.OrderedLabList extends LabList
  constructor: (lab_info, show_number)->
    super( lab_info, show_number, OrderedLab, 'ordered_lab_list_tracker')


Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
medivo-0.2.0 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.25 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.24 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.23 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.22 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.21 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.20 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.19 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.18 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.17 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.16 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.15 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.14 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.13 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.12 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.11 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.10 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.9 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.8 app/assets/javascripts/medivo/lab_list/models.coffee
medivo-0.1.7 app/assets/javascripts/medivo/lab_list/models.coffee