From tschellhorn at gmail.com Thu Nov 2 14:50:03 2006 From: tschellhorn at gmail.com (Till) Date: Thu, 2 Nov 2006 20:50:03 +0100 Subject: [Ym4r-user] Update map Message-ID: <59ca14f50611021150g58ba3df6vd3c1eaeeee690947@mail.gmail.com> 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: blabla <%= javascript_include_tag :defaults %> <%= GMap.header %> <%= @map.to_html %> <%= @map.div(:width => 600, :height => 400) %> <%= link_to_remote("Update", :url => {:action => :shift}) %> 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 From guilhem.vellut at gmail.com Fri Nov 3 04:11:19 2006 From: guilhem.vellut at gmail.com (Guilhem Vellut) Date: Fri, 3 Nov 2006 10:11:19 +0100 Subject: [Ym4r-user] Update map In-Reply-To: <59ca14f50611021150g58ba3df6vd3c1eaeeee690947@mail.gmail.com> References: <59ca14f50611021150g58ba3df6vd3c1eaeeee690947@mail.gmail.com> Message-ID: <43f4b6ee0611030111q5c4a5097rd68e284a8e15f5da@mail.gmail.com> 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 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: > > blabla > <%= javascript_include_tag :defaults %> > <%= GMap.header %> > <%= @map.to_html %> > > <%= @map.div(:width => 600, :height => 400) %> > <%= link_to_remote("Update", :url => {:action => :shift}) %> > > > > 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 From tschellhorn at gmail.com Fri Nov 3 16:35:59 2006 From: tschellhorn at gmail.com (Till) Date: Fri, 3 Nov 2006 22:35:59 +0100 Subject: [Ym4r-user] Update map In-Reply-To: <59ca14f50611031217u1576793br22c376f58b5dd52b@mail.gmail.com> References: <59ca14f50611021150g58ba3df6vd3c1eaeeee690947@mail.gmail.com> <43f4b6ee0611030111q5c4a5097rd68e284a8e15f5da@mail.gmail.com> <59ca14f50611031217u1576793br22c376f58b5dd52b@mail.gmail.com> Message-ID: <59ca14f50611031335wa903418yedfc56aa37cdb46e@mail.gmail.com> Obviously that was the problem. Everything works fine in my new app.. thanks till On 11/3/06, Till 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 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: > > > > > > blabla > > > <%= javascript_include_tag :defaults %> > > > <%= GMap.header %> > > > <%= @map.to_html %> > > > > > > <%= @map.div(:width => 600, :height => 400) %> > > > <%= link_to_remote("Update", :url => {:action => :shift}) %> > > > > > > > > > > > > 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 From tschellhorn at gmail.com Mon Nov 6 14:58:18 2006 From: tschellhorn at gmail.com (Till) Date: Mon, 6 Nov 2006 20:58:18 +0100 Subject: [Ym4r-user] Event listeners Message-ID: <59ca14f50611061158g77f0e24bx5614c8f97fa97b7@mail.gmail.com> Hi! Your plugin is really great! Thanks. One more little question. Is it possible to add event listeners to the maps via your plugin? greetings /till -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ym4r-user/attachments/20061106/6b1c6f4f/attachment.html From guilhem.vellut at gmail.com Tue Nov 7 05:51:32 2006 From: guilhem.vellut at gmail.com (Guilhem Vellut) Date: Tue, 7 Nov 2006 11:51:32 +0100 Subject: [Ym4r-user] Event listeners In-Reply-To: <59ca14f50611061158g77f0e24bx5614c8f97fa97b7@mail.gmail.com> References: <59ca14f50611061158g77f0e24bx5614c8f97fa97b7@mail.gmail.com> Message-ID: <43f4b6ee0611070251q331dff03wa9b1d512adf9b75d@mail.gmail.com> Hello, Thank you! Events are possible. Either through the @map.record_init "azeazeae" (for arbitrary events like domlistener) or through the @map.event_init(@map,:click,"function(){alert('HOYOYO');}"). The latter will give you: GEvent.addListener(map,"click", function(){alert('HOYOYO');}) inserted during initialization. guilhem On 11/6/06, Till wrote: > > Hi! > > Your plugin is really great! Thanks. > > One more little question. > Is it possible to add event listeners to the maps via your plugin? > > greetings > /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/20061107/838358b5/attachment-0001.html From tschellhorn at gmail.com Tue Nov 7 16:59:28 2006 From: tschellhorn at gmail.com (Till) Date: Tue, 7 Nov 2006 22:59:28 +0100 Subject: [Ym4r-user] Event listeners In-Reply-To: <43f4b6ee0611070251q331dff03wa9b1d512adf9b75d@mail.gmail.com> References: <59ca14f50611061158g77f0e24bx5614c8f97fa97b7@mail.gmail.com> <43f4b6ee0611070251q331dff03wa9b1d512adf9b75d@mail.gmail.com> Message-ID: <59ca14f50611071359o59e6f639p79d8893504d6b2ad@mail.gmail.com> I don't get it! Is it right like this? I think I'm messing around with the @maps and @markers !? /till class MapController < ApplicationController def index @map = GMap.new("map_div") @map.control_init(:large_map => true) @map.center_zoom_init([59.91106, 10.72223],13) @map.overlay_init(GMarker.new([59.91122, 10.72217], :title => "Hello", :info_window => "Blabla!", :draggable => "true")) end def shift @map= Variable.new("map") @marker = GMarker.new([59.92222, 10.73333], :title => "Update", :draggable => "true") @marker.event_init(@marker, :click, "function(){ marker.openInfoWindowHtml('hei');}") end end shift.rjs: page << @map.add_overlay(@marker) On 11/7/06, Guilhem Vellut wrote: > > Hello, > Thank you! > Events are possible. Either through the @map.record_init "azeazeae" (for > arbitrary events like domlistener) or through the @map.event_init(@map,:click,"function(){alert('HOYOYO');}"). > The latter will give you: GEvent.addListener(map,"click", > function(){alert('HOYOYO');}) inserted during initialization. > > guilhem > > On 11/6/06, Till < tschellhorn at gmail.com> wrote: > > > Hi! > > > > Your plugin is really great! Thanks. > > > > One more little question. > > Is it possible to add event listeners to the maps via your plugin? > > > > greetings > > /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/20061107/e497d768/attachment.html From guilhem.vellut at gmail.com Wed Nov 8 02:28:27 2006 From: guilhem.vellut at gmail.com (Guilhem Vellut) Date: Wed, 8 Nov 2006 08:28:27 +0100 Subject: [Ym4r-user] Event listeners In-Reply-To: <59ca14f50611071359o59e6f639p79d8893504d6b2ad@mail.gmail.com> References: <59ca14f50611061158g77f0e24bx5614c8f97fa97b7@mail.gmail.com> <43f4b6ee0611070251q331dff03wa9b1d512adf9b75d@mail.gmail.com> <59ca14f50611071359o59e6f639p79d8893504d6b2ad@mail.gmail.com> Message-ID: <43f4b6ee0611072328y4220ec7fv40415ba026ee60d2@mail.gmail.com> actually the _init methods are only for initialization (when you first create the map). If you want to use rjs, you can have something like this in your rjs (instead of your @marker.event_init(......) in the controller): #First you have to declare (in JS) the marker, so that in JS, the add_overlay and the on_click refer to the same JS variable. page << @marker.declare("my_marker") page << @map.add_overlay(@marker) page << @marker.on_click("function(){ marker.openInfoWindowHtml('hei');}") If you use Firefox, I advise you to install the Firebug extension with the show XmlHttpRequest option turned on, so it allows for viewing what happened during the call. guilhem On 11/7/06, Till wrote: > > I don't get it! > Is it right like this? > I think I'm messing around with the @maps and @markers !? > /till > > class MapController < ApplicationController > def index > @map = GMap.new("map_div") > @map.control_init(:large_map => true) > @map.center_zoom_init([59.91106, 10.72223],13) > @map.overlay_init(GMarker.new([59.91122, 10.72217], :title => "Hello", > :info_window => "Blabla!", :draggable => "true")) > end > def shift > @map= Variable.new("map") > @marker = GMarker.new([59.92222, 10.73333], :title => "Update", > :draggable => "true") > @marker.event_init(@marker, :click, "function(){ > marker.openInfoWindowHtml('hei');}") > end > end > > shift.rjs: > page << @map.add_overlay(@marker) > > On 11/7/06, Guilhem Vellut < guilhem.vellut at gmail.com> wrote: > > > > Hello, > > Thank you! > > Events are possible. Either through the @ map.record_init "azeazeae" > > (for arbitrary events like domlistener) or through the @map.event_init(@map,:click,"function(){alert('HOYOYO');}"). > > The latter will give you: GEvent.addListener(map,"click", > > function(){alert('HOYOYO');}) inserted during initialization. > > > > guilhem > > > > On 11/6/06, Till < tschellhorn at gmail.com> wrote: > > > > > Hi! > > > > > > Your plugin is really great! Thanks. > > > > > > One more little question. > > > Is it possible to add event listeners to the maps via your plugin? > > > > > > greetings > > > /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/20061108/8d0c1017/attachment.html From tschellhorn at gmail.com Wed Nov 8 06:22:38 2006 From: tschellhorn at gmail.com (Till) Date: Wed, 8 Nov 2006 12:22:38 +0100 Subject: [Ym4r-user] Event listeners In-Reply-To: <43f4b6ee0611072328y4220ec7fv40415ba026ee60d2@mail.gmail.com> References: <59ca14f50611061158g77f0e24bx5614c8f97fa97b7@mail.gmail.com> <43f4b6ee0611070251q331dff03wa9b1d512adf9b75d@mail.gmail.com> <59ca14f50611071359o59e6f639p79d8893504d6b2ad@mail.gmail.com> <43f4b6ee0611072328y4220ec7fv40415ba026ee60d2@mail.gmail.com> Message-ID: <59ca14f50611080322rf2242d2u8faf1537213db018@mail.gmail.com> Ok, thanks for your help. I'll install the extension later. /till On 11/8/06, Guilhem Vellut wrote: > > actually the _init methods are only for initialization (when you first > create the map). If you want to use rjs, you can have something like this in > your rjs (instead of your @marker.event_init(......) in the controller): > #First you have to declare (in JS) the marker, so that in JS, the > add_overlay and the on_click refer to the same JS variable. > page << @marker.declare("my_marker") > page << @map.add_overlay(@marker) > page << @marker.on_click("function(){ marker.openInfoWindowHtml('hei');}") > > If you use Firefox, I advise you to install the Firebug extension with the > show XmlHttpRequest option turned on, so it allows for viewing what happened > during the call. > > guilhem > > > On 11/7/06, Till wrote: > > > > I don't get it! > > Is it right like this? > > I think I'm messing around with the @maps and @markers !? > > /till > > > > class MapController < ApplicationController > > def index > > @map = GMap.new("map_div") > > @map.control_init(:large_map => true) > > @map.center_zoom_init([59.91106, 10.72223],13) > > @map.overlay_init(GMarker.new([59.91122, 10.72217], :title => > > "Hello", :info_window => "Blabla!", :draggable => "true")) > > end > > def shift > > @map= Variable.new("map") > > @marker = GMarker.new([59.92222, 10.73333], :title => "Update", > > :draggable => "true") > > @marker.event_init(@marker, :click, "function(){ > > marker.openInfoWindowHtml('hei');}") > > end > > end > > > > shift.rjs: > > page << @map.add_overlay(@marker) > > > > On 11/7/06, Guilhem Vellut < guilhem.vellut at gmail.com> wrote: > > > > > > Hello, > > > Thank you! > > > Events are possible. Either through the @ map.record_init "azeazeae" > > > (for arbitrary events like domlistener) or through the @map.event_init(@map,:click,"function(){alert('HOYOYO');}"). > > > The latter will give you: GEvent.addListener(map,"click", > > > function(){alert('HOYOYO');}) inserted during initialization. > > > > > > guilhem > > > > > > On 11/6/06, Till < tschellhorn at gmail.com> wrote: > > > > > > > Hi! > > > > > > > > Your plugin is really great! Thanks. > > > > > > > > One more little question. > > > > Is it possible to add event listeners to the maps via your plugin? > > > > > > > > greetings > > > > /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/20061108/c76b3884/attachment.html