Hi! I''ve just started playing around with the ym4r-plugin and try to update a map as explained in the README-example... but nothing happens. I can update normal html. Heres my baby-code: class AdminController < ApplicationController def index @map = GMap.new("map_div") @map.control_init(:large_map => true) @map.center_zoom_init([59.91106, 10.72223],16) @map.overlay_init(GMarker.new([59.91122, 10.72217], :title => "Great!", :info_window => "Hi")) render :action => ''index'' end def shift @map = Variable.new("map") @marker = GMarker.new([59.00000, 10.00005], :title => "Update", :info_window => "I have been placed through RJS") end my index.rhtml: <html><head><title>blabla</title> <%= javascript_include_tag :defaults %> <%= GMap.header %> <%= @map.to_html %> </head><body> <%= @map.div(:width => 600, :height => 400) %> <%= link_to_remote("Update", :url => {:action => :shift}) %> </body> </html> my shift.rjs: page << @map.clear_overlays page << @map.add_overlay(@marker) What''s wrong here?? thanks in advance, till -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ym4r-user/attachments/20061102/bcfd7a47/attachment.html
Hello, I don''t know if it is a typo in copying to the mail but in the shift.rjs, there is a space between the @ and the map in the first line, which should not be there: page << @ map.clear_overlays I tried without the space on my computer and I get the expected result: the marker on Oslo disappears and there is a new marker somewhere south of Larvik. guilhem On 11/2/06, Till <tschellhorn at gmail.com> wrote:> > Hi! > > I''ve just started playing around with the ym4r-plugin and try to update a > map as explained in the README-example... > but nothing happens. I can update normal html. > > Heres my baby-code: > > class AdminController < ApplicationController > def index > @map = GMap.new("map_div") > @map.control_init(:large_map => true) > @map.center_zoom_init([59.91106, 10.72223],16) > @map.overlay_init(GMarker.new([59.91122, 10.72217], :title => > "Great!", :info_window => "Hi")) > render :action => ''index'' > end > def shift > @map = Variable.new("map") > @marker = GMarker.new([59.00000, 10.00005], :title => "Update", > :info_window => "I have been placed through RJS") > end > > my index.rhtml: > > <html><head><title>blabla</title> > <%= javascript_include_tag :defaults %> > <%= GMap.header %> > <%= @map.to_html %> > </head><body> > <%= @map.div(:width => 600, :height => 400) %> > <%= link_to_remote("Update", :url => {:action => :shift}) %> > </body> > </html> > > my shift.rjs: > > page << @ map.clear_overlays > page << @map.add_overlay(@marker) > > What''s wrong here?? > > thanks in advance, > till > > _______________________________________________ > Ym4r-user mailing list > Ym4r-user at rubyforge.org > http://rubyforge.org/mailman/listinfo/ym4r-user > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ym4r-user/attachments/20061103/3830f038/attachment.html
Obviously that was the problem. Everything works fine in my new app.. thanks till On 11/3/06, Till <tschellhorn at gmail.com> wrote:> > No, that''s just a typo in the mail. > I''ve pasted the code in an old example rails-app. > Maybe i should just try to create a new app...who knows. > > Result comes later. > Thanks > /till > > > > > > > On 11/3/06, Guilhem Vellut <guilhem.vellut at gmail.com > wrote: > > > > Hello, > > > > I don''t know if it is a typo in copying to the mail but in the shift.rjs, > > there is a space between the @ and the map in the first line, which should > > not be there: > > page << @ map.clear_overlays > > I tried without the space on my computer and I get the expected result: > > the marker on Oslo disappears and there is a new marker somewhere south of > > Larvik. > > > > guilhem > > > > > > On 11/2/06, Till < tschellhorn at gmail.com> wrote: > > > > > Hi! > > > > > > I''ve just started playing around with the ym4r-plugin and try to > > > update a map as explained in the README-example... > > > but nothing happens. I can update normal html. > > > > > > Heres my baby-code: > > > > > > class AdminController < ApplicationController > > > def index > > > @map = GMap.new("map_div") > > > @map.control_init(:large_map => true) > > > @map.center_zoom_init ([ 59.91106, 10.72223],16) > > > @map.overlay_init(GMarker.new([59.91122, 10.72217], :title => > > > "Great!", :info_window => "Hi")) > > > render :action => ''index'' > > > end > > > def shift > > > @map = Variable.new("map") > > > @marker = GMarker.new([59.00000, 10.00005], :title => "Update", > > > :info_window => "I have been placed through RJS") > > > end > > > > > > my index.rhtml: > > > > > > <html><head><title>blabla</title> > > > <%= javascript_include_tag :defaults %> > > > <%= GMap.header %> > > > <%= @map.to_html %> > > > </head><body> > > > <%= @map.div(:width => 600, :height => 400) %> > > > <%= link_to_remote("Update", :url => {:action => :shift}) %> > > > </body> > > > </html> > > > > > > my shift.rjs: > > > > > > page << @ map.clear_overlays > > > page << @map.add_overlay(@marker) > > > > > > What''s wrong here?? > > > > > > thanks in advance, > > > till > > > > > > _______________________________________________ > > > Ym4r-user mailing list > > > Ym4r-user at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/ym4r-user > > > > > > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ym4r-user/attachments/20061103/d3f4c836/attachment.html