adding driving directions to the registration page
authorAnthony Talarico <talarico@gaslightmedia.com>
Tue, 12 Dec 2017 14:05:16 +0000 (09:05 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Tue, 12 Dec 2017 14:05:16 +0000 (09:05 -0500)
adding the code for the directions button next to the view map button on
the registrations page

views/front/registrations/registration.html

index e3a1b5b..e98b477 100644 (file)
@@ -37,6 +37,7 @@
                 
                 <div class="glm-row">
                     {if $regEvent.locations.lat && $regEvent.locations.lon}
+                        
                         <div class="glm-small-12 glm-medium-4 glm-columns glm-reg-event-profile-map-container">
                             <div id="glm-reg-map-container">
                                 <div id="glm-reg-map" class="glm-reg-map">(map loads here)</div>
                         </div>
                         <div class="glm-small-12 glm-columns glm-reg-event-profile-details">
                             <div id="glm-reg-detail-map-button" class="button map-button">View Map</div>
-                            <div id="glm-reg-detail-directions-button" class="button map-button">Get Directions</div>
+                            <form id="MemberDrivingDirectionsForm" name="MemberDrivingDirectionsForm" method="post" action="">
+                                <input type="hidden" id="MemberLocation" name="MemberLocation" value="{$member.member_name|escape}">
+                                <input type="hidden" id="MemberLat" name="MemberLat" value="{$regEvent.locations.lat}">
+                                <input type="hidden" id="MemberLon" name="MemberLon" value="{$regEvent.locations.lon}">
+                                <input type="submit" class="button map-button text-center glm-reg-detail-directions-button map-button" id="glm-reg-detail-directions-button" name="MemberDrivingDirectionSubmit" value="Directions">
+                            </form>
                         </div>
                     {/if}
                     {literal}
@@ -383,5 +389,13 @@ jQuery(function($){
 
     }
     google.maps.event.addDomListener(window, 'load', initMap);
+    jQuery("#MemberDrivingDirectionsForm").submit(function(){
+        var place = jQuery("#MemberLocation").val().replace( new RegExp( " ", "g" ), '+' );
+        var lat = jQuery("#MemberLat").val();
+        var lon = jQuery("#MemberLon").val();
+        var url = "https://maps.google.com/maps?daddr=" + place + "%40" + lat + "," + lon;
+        window.open(url, '_blank');
+        return false;
+    });
 });
 </script>