Basic but hacky way to get events out of map

This commit is contained in:
Will Marshall
2014-06-05 15:08:50 +10:00
parent 476eeef69d
commit 843ea9faef
3 changed files with 19 additions and 6 deletions

View File

@@ -1,7 +1,10 @@
Darkswarm.controller "MapCtrl", ($scope, MapConfiguration)->
Darkswarm.controller "MapCtrl", ($scope, MapConfiguration, OfnMap, Marker)->
$scope.OfnMap = OfnMap
console.log Marker
window.Marker = Marker
$scope.map =
center:
latitude: 45
longitude: -73
latitude: -37.775757
longitude: 144.743663
zoom: 8
styles: MapConfiguration.options

View File

@@ -1,7 +1,7 @@
module SharedHelper
def inject_json(name, partial)
render "json/injection", name: name, partial: partial
def inject_json(name, partial, opts = {})
render "json/injection", {name: name, partial: partial}.merge(opts)
end
def distributor_link_class(distributor)

View File

@@ -1,5 +1,15 @@
- content_for :scripts do
%script{src: "//maps.googleapis.com/maps/api/js?sensor=false"}
= inject_json "enterprisesForMap" , "enterprises_for_map", collection: @enterprises
%map{"ng-controller" => "MapCtrl"}
%google-map{center: "map.center", zoom: "map.zoom", styles: "map.styles"}
%span{"ng-repeat" => "marker in OfnMap.enterprises"}
{{ marker.visible }}
%google-map{center: "map.center", zoom: "map.zoom", styles: "map.styles", draggable: "true"}
%markers{models: "OfnMap.enterprises", fit: "true",
coords: "'self'", icon: "'icon'", click: "'reveal'"}