summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/views
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2016-07-21 19:58:33 -0600
committermo khan <mo@mokhan.ca>2016-07-21 19:58:33 -0600
commite96fdfd79976fcab0dba00ce363e96885f3c9ff3 (patch)
tree63047c80ce59c618da35fd14f64705abfbbc7599 /app/assets/javascripts/views
parentd4fea11d70f464d6c107854fb4af344f3c25e8df (diff)
extract google maps class and load once.
Diffstat (limited to 'app/assets/javascripts/views')
-rw-r--r--app/assets/javascripts/views/google_map.js.coffee18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/assets/javascripts/views/google_map.js.coffee b/app/assets/javascripts/views/google_map.js.coffee
new file mode 100644
index 0000000..07f3062
--- /dev/null
+++ b/app/assets/javascripts/views/google_map.js.coffee
@@ -0,0 +1,18 @@
+class Stronglifters.GoogleMap
+ constructor: (div) ->
+ @div = document.getElementById(div)
+
+ present: (options) ->
+ console.log("presenting")
+ coordinates = new google.maps.LatLng(options.latitude, options.longitude)
+ map = new google.maps.Map(@div, {
+ center: coordinates,
+ zoom: 15,
+ scrollwheel: false,
+ mapTypeId: google.maps.MapTypeId.TERRAIN,
+ })
+ marker = new google.maps.Marker({
+ map: map,
+ position: coordinates,
+ title: options.name
+ })