From: Chuck Scott Date: Tue, 24 Mar 2015 20:13:14 +0000 (-0400) Subject: Fixed some map issues for when no markers are placed X-Git-Tag: v1.0.0~42 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=a6bb55d78b0234bd14f415d208cfa2cb500cc4ab;p=WP-Plugins%2Fglm-member-db.git Fixed some map issues for when no markers are placed --- diff --git a/config/plugin.ini b/config/plugin.ini index f942a5ae..cc31b0e4 100644 --- a/config/plugin.ini +++ b/config/plugin.ini @@ -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 diff --git a/controllers/front.php b/controllers/front.php index 50a0526f..ca6536a3 100644 --- a/controllers/front.php +++ b/controllers/front.php @@ -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); diff --git a/views/front/members/list.html b/views/front/members/list.html index 27204197..57c3d5c9 100644 --- a/views/front/members/list.html +++ b/views/front/members/list.html @@ -189,12 +189,10 @@ * 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, }); @@ -252,7 +250,6 @@ bounds.extend(marker.position); {/foreach} - {/if} // Fit map to bounds of all markers map.fitBounds(bounds); @@ -264,7 +261,12 @@ } google.maps.event.removeListener(mapLoadedListener); }); + + {else} + + {/if} + {/if} });