Filip Nguyen
Filip Nguyen

Reputation: 1039

Rails 3 popup window on link

I have link that naviates to certain controller and action: <%= link_to "Detail", {:action=> 'detail', :id=> person.id} %>

I want this window to be a popup window, do some changes there and after some controller action finishes e.g. action Save, I want to close this popup window. In earlier versions of Rails this was done bu :popup=> true which is already deprecated. How to do it in Rails3?

Upvotes: 0

Views: 2397

Answers (1)

Cody Swann
Cody Swann

Reputation: 677

This is the quick and dirty solution.

<%= link_to "Detail", {:action=> 'detail', :id=> person.id}, :onclick => "javascript:window.open('page.html','popup','width=400,height=200');" %>

If you're loading jQuery you can be more eloquent and unobtrusive, or use something like this:

http://www.openhosting.co.uk/articles/webdev/5918/

Hope that helps.

Upvotes: 1

Related Questions