jh100000
2006-Jul-24 13:16 UTC
[Rails] how to get your controller to close a browser popup window
While editing a record I need to have a link to create a new record in another scaffold. I''ve done this by using a popup window <%= link_to("Add new Person", "/person/new", :popup => [''window_name'', ''width=600,height=600'']) %> It all works great - but when the save is done I want to kill the popup window. I''ve got the Cancel button to close the window by using this <a href="javascript:self.close()">Close the window</a> But how can I get the controller to force a close? -- Posted via http://www.ruby-forum.com/.
zee ho
2006-Jul-24 13:26 UTC
[Rails] how to get your controller to close a browser popup window
how about do it in ajax-like way. in the return page you can write javacript callback function. what do you think? On 7/24/06, jh100000 <john.henderson@mac.com> wrote:> > While editing a record I need to have a link to create a new record in > another scaffold. > > I''ve done this by using a popup window > > <%= link_to("Add new Person", "/person/new", :popup => [''window_name'', > ''width=600,height=600'']) %> > > It all works great - but when the save is done I want to kill the popup > window. > > I''ve got the Cancel button to close the window by using this > <a href="javascript:self.close()">Close the window</a> > > But how can I get the controller to force a close? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- When you came to this world, there is no going back, And , when you can''t go back, you only have to worry about the best way of moving forward, The rest is up to God, including the danger ---- From <Alchemist> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060724/a10aaf8c/attachment.html
jh100000
2006-Jul-24 13:34 UTC
[Rails] Re: how to get your controller to close a browser popup wind
zee ho wrote:> how about do it in ajax-like way. in the return page you can write > javacript > callback function. what do you think?sounds good... do you know how? i''ve got some ajax stuff in my project but I don''t understand it to be honest! -- Posted via http://www.ruby-forum.com/.
Al Evans
2006-Jul-24 23:26 UTC
[Rails] Re: how to get your controller to close a browser popup wind
jh100000 wrote:> zee ho wrote: >> how about do it in ajax-like way. in the return page you can write >> javacript >> callback function. what do you think? > > sounds good... do you know how? i''ve got some ajax stuff in my project > but I don''t understand it to be honest!Here''s an example. Sorry for the dopey names, I just copied this out of some stuff I was testing the other day: In my rhtml file, I had <%=link_to_remote "Blurt", :url => { :action => "blurt"}%> <br /> <%=link_to_remote "Flurb", :url => { :action => "flurb"}%> <br /><br /> In my controller, I had def blurt render :update do |page| page << ''mywindow = window.open("http://url.for.source.com", "A Window")'' end end def flurb render :update do |page| page << ''mywindow.close()'' end end --Al Evans -- Posted via http://www.ruby-forum.com/.
jh100000
2006-Jul-25 11:12 UTC
[Rails] Re: how to get your controller to close a browser popup wind
Cheers Al, that''s neat - and nearly what I need - but not quite... So now I''ve got a link_to_remote on view X which pops up a new window with a view of controller Y. What i really need is a "closeme" function. -- Posted via http://www.ruby-forum.com/.