Fixed some map issues for when no markers are placed
authorChuck Scott <cscott@gaslightmedia.com>
Tue, 24 Mar 2015 20:13:14 +0000 (16:13 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Tue, 24 Mar 2015 20:13:14 +0000 (16:13 -0400)
config/plugin.ini
controllers/front.php
views/front/members/list.html

index f942a5a..cc31b0e 100644 (file)
@@ -58,6 +58,7 @@ timezone = America/Detroit
 ; Default map location is Gaslight Media office
 map_default_lat = 45.3749
 map_default_lon = -84.9592
+map_default_zoom = 10
 
 ; Front-end Member Listing - [glm-members-list]
 front-config['list_show_map'] = true
index 50a0526..ca6536a 100644 (file)
@@ -408,6 +408,9 @@ class glmMembersFront extends GlmPluginSupport
         $smarty->templateAssign ( $this->config['term']);
         $smarty->templateAssign ( $this->config['phrase']);
         $smarty->templateAssign ( 'googleMapsBrowserApiKey', $this->config['googleMapsApiKey']);
+        $smarty->templateAssign ( 'mapDefaultLat', $this->config['map_default_lat']);
+        $smarty->templateAssign ( 'mapDefaultLon', $this->config['map_default_lon']);
+        $smarty->templateAssign ( 'mapDefaultZoom', $this->config['map_default_zoom']);
 
         // Add all terms and phrases from the config/plugin.ini file
 //        $smarty->templateAssign ( 'terms', $this->config->term);
index 2720419..57c3d5c 100644 (file)
              *  API reference: https://developers.google.com/maps/documentation/javascript/reference
              */
             
-            // Set default - Need to make this configurable
-            var startLat = 45;
-            var startLon = -84;
-            
             // Create a Google Map object
-            var map = new google.maps.Map(document.getElementById('locationMap'), {  
+            var map = new google.maps.Map(document.getElementById('locationMap'), {
+               center: new google.maps.LatLng({$mapDefaultLat}, {$mapDefaultLon}),
+               zoom: {$mapDefaultZoom},
                 disableDefaultUI: false,   
                 mapTypeId: google.maps.MapTypeId.MAP,  
             });  
             bounds.extend(marker.position);
             
         {/foreach}
-    {/if}
 
             // Fit map to bounds of all markers
             map.fitBounds(bounds);
                 }
                 google.maps.event.removeListener(mapLoadedListener);
             });
+         
+    {else}
+            
             
+    {/if}
+
             
 {/if}            
         });