Static Google Maps in library page
authorDan Scott <dscott@laurentian.ca>
Tue, 9 Dec 2014 19:10:12 +0000 (14:10 -0500)
committerDan Scott <dscott@laurentian.ca>
Tue, 9 Dec 2014 19:10:12 +0000 (14:10 -0500)
Just a proof of concept, not meant to be merged.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/templates/opac/parts/library/core_info.tt2
Open-ILS/src/templates/opac/parts/library/maps.tt2 [new file with mode: 0644]

index 1398f70..45a24c7 100644 (file)
@@ -42,6 +42,7 @@
             <span property="postalCode">[% ctx.mailing_address.post_code | html %]</span><br />
         </div>
     </div>
+    [%- INCLUDE "opac/parts/library/maps.tt2"; %]
     [%- END; %]
 
     [%- IF ctx.library.parent_ou; %]
diff --git a/Open-ILS/src/templates/opac/parts/library/maps.tt2 b/Open-ILS/src/templates/opac/parts/library/maps.tt2
new file mode 100644 (file)
index 0000000..4729b44
--- /dev/null
@@ -0,0 +1,25 @@
+[%# Just a static map for now as a proof of concept;
+  # the LatLng could be replaced by a (cached) server side lookup,
+  # a client side GeoCoder request (https://developers.google.com/maps/documentation/javascript/reference#Geocoder),
+  # or by yet another OUS (but really, who's going to enter that?!)
+-%]
+<div id="library_map"></div>
+<style>
+  #library_map {
+    width: 500px;
+    height: 400px;
+  }
+</style>
+<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
+<script>
+  function initialize_libmap() {
+    var map_canvas = document.getElementById('library_map');
+    var map_options = {
+      center: new google.maps.LatLng(44.5403, -78.5463),
+      zoom: 12,
+      mapTypeId: google.maps.MapTypeId.ROADMAP
+    }
+    var map = new google.maps.Map(map_canvas, map_options)
+  }
+  google.maps.event.addDomListener(window, 'load', initialize_libmap);
+</script>