-template =
+templates =
   studentList: _.template """
 <div id="bus-view">
   <div class="student">

    new google.maps.StyledMapType @styles, name: 'Boston Public Schools'

  initialize: (options) ->
    @mapEl             = document.getElementById 'map-canvas'
    @currentAssignment = @collection.find (assignment) ->
      assignment.get('token') is cookie.get('current_assignment')

    @listenTo @collection, 'reset', @updateMarker

    _.bindAll this

  render: ->
    @studentList = new StudentList
      el: document.getElementById 'header'
      collection: @collection
      currentAssignment: @currentAssignment
    @studentList.render()
    
    @map = new google.maps.Map @mapEl, {
      center: @currentAssignment.get('latLng')
      zoom: 14
      mapTypeControlOptions:
        mapTypeIds: ['map_style']
    }

    @map.mapTypes.set 'map_style', @styledMap()
    @map.setMapTypeId 'map_style'

    @updateMarker()

    @intervalID = setInterval @refreshLocations, 60000

  refreshLocations: ->
    @collection.fetch
      reset: true

  updateMarker: ->
    if @marker?
      @marker.setMap null

    center = @currentAssignment.get 'latLng'
    @marker = new google.maps.Marker
      position: center
      map: @map
      title: @currentAssignment.get 'student_name'

    @map.setCenter center

  updateCurrentStudent: (event) ->
    @currentAssignment = @collection.find (assignment) ->

  </div>
</div>
  """

Wmsb.Views.MapView = Backbone.View.extend
  events:
