Anybody know a prototype helper that creates a popup window?

Hi,

I'm trying to get a form to open up in a new window. I know how to
toggle divs but haven't been able to find anything on how to get
another window to open...any ideas?

Ron

So I realized after I posted this that thre is a :popup option in
link_to. but for some reason when I add it to my links, it just loads
a full page, not a popup. I've included javascript on my layouts...I
heard somewhere that there is a prototype window--something different
from a pop up window. Anybody know anything about that type of
window?

Ron

So I realized after I posted this that thre is a :popup option in
link_to. but for some reason when I add it to my links, it just loads
a full page, not a popup. I've included javascript on my layouts...I
heard somewhere that there is a prototype window--something different
from a pop up window. Anybody know anything about that type of
window?

window.open(url, ...)

I suspect that when people mean prototype window they actually mean a
chunk of html that has been styled to look like a window within the
window (and normally scripted so that you can move it around, resize
it etc...)

Fred

Hi Fred,

So I guess I'm not sure what the syntax would be?
<%=link_to_remote 'Link', "window.open(?)%>
?

Hi Fred,

So I guess I'm not sure what the syntax would be?
<%=link_to_remote 'Link', "window.open(?)%>
?

Nope, what you want is link_to_function (which is just fancy pants for
<a onclick="..."> </a>

Fred

Okay Fred...that makes more sense. That's really helpful. Thanks, as
always.

As for the Prototype windows, I've managed to get a nice window to
open using Prototype Window. Its a really nice library that tacks on
to Prototype the ability to generate Prototype-based windows. Its
here: http://prototype-window.xilinus.com/index.html

I included a couple of Javascript files in my javascript folder and
then defined a javascript variable in my view:
win = new Window({className: "mac_os_x", title: "Sample", width:200,
height:150, destroyOnClose: true, recenterAuto:false});
win.getContent().update("<h1>Hello world !!</h1>");

Then I passed win.showCenter(); to a link_to_function tag:
<%=link_to_function 'Add Paper,' "win.showCenter();"%>

Voila! (This code, btw, is from the sample on Prototype Window's
site).

There are several themes that you can use; I had to copy the
stylesheet to the public/stylesheets directory along with a directory
of image files for the particular theme. I'm going to customize the
theme for my app; however, I was just trying to get started.

The only thing I'm not sure about here--maybe someone else knows--is
how to pass a Rails generated URL to the Window. Right now, I can
only get it to show a div on the page or HTML I provide to it. But
there is a getURL method that accepts a string argument that I'd like
to use. When I try and put a link tag helper in, however, the script
doesn't work. I'm thinking maybe if I used RESTful routes, the path
would be a string variable (if I'm not mistaken)--making it perhaps
acceptable as an argument.

Any ideas? I mean, for this to work, its pretty important to be able
to show windows that have views in the Rails App. I've got to figure
out how to get this going somehow.

Ron