From 40c61cfec09e05c9909e1536cc089575a152332d Mon Sep 17 00:00:00 2001
From: Bryce Hewett
This map serves as a visual representation of the mormon missionaries that have left The Church of Jesus Christ of Latter-Day Saints.
Ex-Mormon Missionary Map
-
+
+
diff --git a/public/mainCtrl.js b/public/mainCtrl.js
index fb3ebdf..7f8668d 100644
--- a/public/mainCtrl.js
+++ b/public/mainCtrl.js
@@ -5,9 +5,9 @@
.module('app.main')
.controller('mainController', mainController);
- mainController.$inject = ['$q', '$scope', '$log', '$mdToast', '$mdDialog', '$mdSidenav'];
+ mainController.$inject = ['$q', '$scope', '$log', '$mdToast', '$mdDialog', '$mdSidenav', 'NgMap'];
- function mainController($q, $scope, $log, $mdToast, $mdDialog, $mdSidenav) {
+ function mainController($q, $scope, $log, $mdToast, $mdDialog, $mdSidenav, NgMap) {
var vm = this;
@@ -20,53 +20,50 @@
firebase.initializeApp(firebaseConfig);
+ vm.mapAPI = 'https://maps.googleapis.com/maps/api/js?key=AIzaSyBOuqyDzI-BqSgSjv1cB3K0P5urSjqNj8Y&libraries=places';
+
vm.RMList = {};
vm.missionNames = [];
vm.newRM;
+ var map;
+ vm.mapCenter = {
+ lat: 41,
+ lng: -87
+ };
var geocoder;
- var map;
- var markerArray = [];
- var markerCluster;
+ vm.markerArray = [];
if (window.location.hostname.indexOf('localhost') < 0) {
- $log.debug('not localhost')
var db = 'main/'
} else {
$log.debug('localhost')
var db = 'test/'
- $log.debug(db)
}
vm.toggleNav = function() {
$mdSidenav('left').toggle();
}
- vm.initMap = function() {
- var myLatLng = {lat: 33.328748, lng: -40.497745};
-
- map = new google.maps.Map(document.getElementById('map'), {
- zoom: 3,
- center: myLatLng
- });
-
- markerCluster = new MarkerClusterer(map, markerArray, {imagePath: 'libs/js-marker-clusterer/images/m'});
- }
vm.appInit = function(){
firebase.database().ref(db + 'RMList').once('value').then(function(snapshot) {
vm.RMList = snapshot.val();
- for (var rm in vm.RMList) {
- var latLng = new google.maps.LatLng(vm.RMList[rm].missionDetails.location.lat, vm.RMList[rm].missionDetails.location.lng);
- var marker = new google.maps.Marker({
- position: latLng
- });
- if (vm.missionNames.indexOf(vm.RMList[rm].missionDetails.name) < 0) {
- vm.missionNames.push(vm.RMList[rm].missionDetails.name)
- }
- markerArray.push(marker);
- }
- vm.initMap();
+ NgMap.getMap().then(function(map) {
+ for (var rm in vm.RMList) {
+ var latLng = new google.maps.LatLng(vm.RMList[rm].missionDetails.location.lat, vm.RMList[rm].missionDetails.location.lng);
+ var marker = new google.maps.Marker({
+ position: latLng
+ });
+ if (vm.missionNames.indexOf(vm.RMList[rm].missionDetails.name) < 0) {
+ vm.missionNames.push(vm.RMList[rm].missionDetails.name)
+ }
+ vm.markerArray.push(marker);
+ $log.debug(marker)
+ }
+ vm.markerCluster = new MarkerClusterer(map, vm.markerArray, {
+ imagePath: 'libs/js-marker-clusterer/images/m'});
+ })
}, function(error) {
$log.error(error)
})
@@ -81,42 +78,53 @@
clickOutsideToClose: true
})
.then(function(newRM) {
- map.setCenter(newRM.missionDetails.location);
- var marker = new google.maps.Marker({
- map: map,
- position: newRM.missionDetails.location
- });
+ vm.mapCenter.lat = newRM.missionDetails.location.lat;
+ vm.mapCenter.lng = newRM.missionDetails.location.lng;
+ console.log(vm.mapCenter.lat)
+ console.log(vm.mapCenter.lng)
+
+ NgMap.getMap().then(function(map) {
+ var marker = new google.maps.Marker({
+ position: newRM.missionDetails.location
+ });
+ vm.markerCluster.addMarker(marker);
+
+ })
+
+
+ // map.setCenter(newRM.missionDetails.location);
+
- markerCluster.addMarker(marker);
}, function() {
});
};
function newRMDialogController($q, $mdDialog, missions) {
+
vm = this;
vm.missionNames = missions
vm.gmapsService = new google.maps.places.AutocompleteService();
vm.geocoder = new google.maps.Geocoder();
- // vm.RM = {
- // from: 'Panama City, FL',
- // gender: 'Male',
- // creationDate: 'text',
- // leftChurch: {
- // date: '2015',
- // reason: 'text'
- // },
- // missionDetails: {
- // start: '2007',
- // end: '2009',
- // name: 'Tirana Albania Mission',
- // location: {
- // address: 'Tirana, Albania',
- // }
- // }
- // };
+ vm.RM = {
+ from: 'Panama City, FL',
+ gender: 'Male',
+ creationDate: 'text',
+ leftChurch: {
+ date: '2015',
+ reason: 'text'
+ },
+ missionDetails: {
+ start: '2007',
+ end: '2009',
+ name: 'Tirana Albania Mission',
+ location: {
+ address: 'Tirana, Albania',
+ }
+ }
+ };
vm.cancel = function() {
$mdDialog.cancel();
diff --git a/public/map.html b/public/map.html
index ad19e7d..24de6a1 100644
--- a/public/map.html
+++ b/public/map.html
@@ -1 +1,3 @@
-
+Ex-Mormon Missionary Map
If you served a mission and left the church, add yourself to the map.
Missionaries
+Missions
+