allow multiple maps to be added on a page

This commit is contained in:
Jonny Barnes 2017-01-26 19:51:11 +00:00
parent 264078d058
commit 6cbe62bad2
3 changed files with 82 additions and 87 deletions

View file

@ -45,7 +45,7 @@ const makeOptionsForForm = (map, position, places = null) => {
}
//position is output of navigator.geolocation call
export default function addMapWithPlaces(position) {
export default function addMapWithPlaces(div, position) {
fetch('/places/near/' + position.coords.latitude + '/' + position.coords.longitude + '?u=' + position.coords.accuracy, {
credentials: 'same-origin',
method: 'get'
@ -65,7 +65,7 @@ export default function addMapWithPlaces(position) {
if (json.places.length > 0) {
places = json.places;
}
let map = addMap(position, places);
let map = addMap(div, position, places);
//create a containting div for flexbox styling purposes
let flexboxDiv = document.createElement('div');
let options = makeOptionsForForm(map, position, places);