简体   繁体   English

链接上的Rails 3弹出窗口

[英]Rails 3 popup window on link

I have link that naviates to certain controller and action: <%= link_to "Detail", {:action=> 'detail', :id=> person.id} %> 我有导航到某些控制器和操作的链接:<%= 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 eg action Save, I want to close this popup window. 我希望该窗口是一个弹出窗口,在其中进行一些更改,并在完成某些控制器操作(例如,操作“保存”)后,我想关闭此弹出窗口。 In earlier versions of Rails this was done bu :popup=> true which is already deprecated. 在Rails的早期版本中,bu:popup => true完成了此操作,已弃用。 How to do it in Rails3? 在Rails3中如何做?

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: 如果您正在加载jQuery,则可以变得更加雄辩且不引人注目,或者使用类似以下内容的代码:

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

Hope that helps. 希望能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM