Possible to use rails for a popup?

In my project, I have a need to do a popup window. When the user clicks
on a link (in this case a picture - but the question refers to any
link), I need to popup a page that has an expanded version of that item
for the user to look at - while keeping the original page available at
the same time.

Is this possible using rails? If so, how?

As always (I sound like a broken record here) Thanks in advance

<the item above is for those who, like me, are old enough to remember
records )

—Michael

From Rails API Docs, link_to Examples:

link_to “Busy loop”, { :action => “busy” }, :popup => [‘new_window’,
‘height=300,width=600’]

‘height=300,width=600’ is a string of JavaScript Propertiesfor the
Popup, so you can define other JavaScript Properties for the popup as
well.

then define the “busy” action in your controller, and render a view for
it.
you might want to define a different layout for the popup as it should
not use your default template with navigation and stuff …

def busy
…do stuff here…
render :action => :busy, :layout => :popup
end

  1. then create

3.1) a popup.rb in your app/views/layout folder for the popup with the
basic HTML strcuture (like you do in the application.rhtml layout and
<%= content_for_layout %>
you can re-use this layout for other popups…
3.2) a busy.rhtml view in the view/yourcontroller directory, which will
render the content for the popup layout …

On 11/10/06, Michael S. [email protected]
wrote:

In my project, I have a need to do a popup window. When the user clicks
on a link (in this case a picture - but the question refers to any
link), I need to popup a page that has an expanded version of that item
for the user to look at - while keeping the original page available at
the same time.

Is this possible using rails? If so, how?

Check the API.
http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#M000378

Look for the :popup option.

– James

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs