gmaps4rails2

scope of markers variable for google maps (gmaps4rails gem)

偶尔善良 提交于 2019-12-25 01:24:51
问题 I'm trying to understand javascript, and the way variables are passed around, but I'm not doing too well. I'm trying to refresh a google map's markers with ajax, but nothing is happening. I submit a form, which sends some variables to the controller. Some stuff is processed, and it responds with .js to... find.js.erb $('#collapseTwo ul').html("<%= j render partial: 'events/sidebar', collection: @events %>"); alert(<%= raw @hash.to_json %>); clearMarkers(); markers = handler.addMarkers(<%= raw

Accessing json attributes from marker - gmaps4rails

两盒软妹~` 提交于 2019-12-07 14:42:45
问题 I'm upgrading to gmaps4rails v2. I can't seem to access the marker json attributes from javascript. This worked in the previous version I was using (1.5.6) Specifically Buidling in controller: @users = User.all @hash = Gmaps4rails.build_markers(@users) do |user, marker| marker.lat user.latitude marker.lng user.longitude marker.json({link: "someurl", current: true}) end And in javascript: handler = Gmaps.build('Google'); handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){

Accessing json attributes from marker - gmaps4rails

允我心安 提交于 2019-12-06 03:41:26
I'm upgrading to gmaps4rails v2. I can't seem to access the marker json attributes from javascript. This worked in the previous version I was using (1.5.6) Specifically Buidling in controller: @users = User.all @hash = Gmaps4rails.build_markers(@users) do |user, marker| marker.lat user.latitude marker.lng user.longitude marker.json({link: "someurl", current: true}) end And in javascript: handler = Gmaps.build('Google'); handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){ markers = handler.addMarkers(<%=raw @hash.to_json %>); console.log(markers[0].link); console.log(markers[1]

Gmaps is not defined in rails 4 + gmaps4rails 2.0.3

我们两清 提交于 2019-12-01 23:50:00
问题 Gmaps4rails is not define in rails 4.0.0 Google Maps for Rails i am following this tutorial "http://rubydoc.info/gems/gmaps4rails/2.0.4/frames" 1) Gemfile gem 'gmaps4rails' 2) HTML on view page <div style='width: 800px;'> <div id="map" style='width: 800px; height: 400px;'></div> </div> 3) on view page <script src="//maps.google.com/maps/api/js?v=3.13&sensor=false&libraries=geometry" type="text/javascript"></script> <script src='//google-maps-utility-library-v3.googlecode.com/svn/tags