Forum: Ruby on Rails A quick question on popup windows

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
17d01ff4326c26911481c7a77283b343?d=identicon&s=25 Eric Sloane (Guest)
on 2006-02-11 07:40
(Received via mailing list)
How the hell do you close em off after the action is completed?
Ta,
Eric
17d01ff4326c26911481c7a77283b343?d=identicon&s=25 Eric Sloane (Guest)
on 2006-02-12 03:58
(Received via mailing list)
I'm curious as to how to close a browser window opened as

<%= link_to(image_tag("new_organisation.png", :alt => 'New', :border =>
1), { :controller => 'to_dos', :action => 'to_do_pop_up'}, :popup =>
['new_window', 'height=500,width=800'])

which performs exactly as desired within the controller on submit

And my question is =>

after the record is processed...

flash[:notice] = 'Note was successfully created.'
if !(params['id'] == nil)
    redirect_to :action => 'job_dashboard', :id => @job
else
    render WHAT???    <--- THIS LINE NEEDS TO CLOSE THE POP_UP
end
7c3a0706ce454a5e7c405a63fdcd2c21?d=identicon&s=25 Jim (Guest)
on 2006-02-12 04:07
Eric Sloane wrote:

>     render WHAT???    <--- THIS LINE NEEDS TO CLOSE THE POP_UP
> end

render :text => "<script>window.close()</script>"
17d01ff4326c26911481c7a77283b343?d=identicon&s=25 Eric Sloane (Guest)
on 2006-02-12 06:07
(Received via mailing list)
Thanks Jim - that was exactly what I needed. I figured there had to be
some render method to do that - I'd never have figured render :text tho.
Thanks again.
Cheers,
Eric.
7c3a0706ce454a5e7c405a63fdcd2c21?d=identicon&s=25 Jim (Guest)
on 2006-02-12 17:33
Eric Sloane wrote:
> Thanks Jim - that was exactly what I needed. I figured there had to be
> some render method to do that - I'd never have figured render :text tho.
> Thanks again.
> Cheers,
> Eric.

Well, the     render :text => "string"      just renders the plain text,
or sting - which happens to be  a bit of JavaScript. If a user has
JavaScript disabled in the browser, it won't work.
17d01ff4326c26911481c7a77283b343?d=identicon&s=25 Eric Sloane (Guest)
on 2006-02-12 22:22
(Received via mailing list)
Well, in my current case, I have control over whether JS is enabled - so
that's OK. But out of interest how would we close the window otherwise?
4005a47a8f2ceee49670b920593c1d52?d=identicon&s=25 Ben Munat (Guest)
on 2006-02-12 22:50
(Received via mailing list)
Can't... The only way to control a user's browser is with javascript.
Welcome to the
wonderful world of web programming!

b
17d01ff4326c26911481c7a77283b343?d=identicon&s=25 Eric Sloane (Guest)
on 2006-02-13 02:05
(Received via mailing list)
Bugger!
Thanks Guys
This topic is locked and can not be replied to.