import dataAPI from './firebase'
import _ from 'underscore'

window.dataAPI = dataAPI

let map

function initMap() {
  map = new google.maps.Map(document.getElementById('map-mount'), {
    center: {lat: -34.397, lng: 150.644},
    zoom: 8
  })
}

function renderMarker(dataPoint) {
  let marker = new google.maps.Marker({
    position: {lat: dataPoint.lat, lng: dataPoint.long},
    map: map,
    title: dataPoint.text
  });
}

function renderData(dataList) {
  _.each(dataList, renderMarker)
}

function initialise() {
  initMap()
  // Grab data
  dataAPI.row(renderData)
  // Add markers to map
}

$( document ).ready(initialise)

@@ -52,16 +52,56 @@
 erscore'
+%0Aimport infoDisplay from './infoDisplay'
 %0A%0Awindow
@@ -460,9 +460,84 @@
   %7D)
-;
+%0A%0A  marker.addListener('click', function() %7B%0A    infoDisplay(dataPoint)%0A  %7D)
 %0A%7D%0A%0A
@@ -654,16 +654,27 @@
 rab data
+, render it
 %0A  dataA
@@ -696,32 +696,8 @@
 ta)%0A
-  // Add markers to map%0A
 %7D%0A%0A$

Integrate infodisplay