1

What is the most straightforward mechanism by which to "link_to_remote" and popout a window with the data? I need "link_to_remote" because I need to pass certain data along with the url without redoing my routes. If this would be better served by a "link_to" without the need to redo my routes, I'm all for it. I simply can't get it to work, atm.

Thoughts?

molf
  • 73,644
  • 13
  • 135
  • 118
humble_coder
  • 2,777
  • 7
  • 34
  • 46

3 Answers3

2

Perhaps you're looking for something like:

<%= link_to_function "Show Article in Popout window",
      "window.open(#{article_path(article).to_json}, 'show_article')" %>
Duncan Beevers
  • 1,830
  • 11
  • 17
0

link_to_remote is used to do XHR requests, so you cannot use it to open a popup window with the response.

You don't need to redo your route anyway, because I assume that if you want to use link_to* to get some data, then you have your controller/action pair defined and accessible already.

Also, usually, Rails applications have the catch all route enabled to match :controller/:action. If that's your case, then you can use link_to that controller/action to get the data.

aurelian
  • 166
  • 7
  • Well, all the calculations occur in a non-standard/non-restful action "view_chart" based on an item's data. In any case, how would you recommend I go about it? link_to "popup" doesn't seem to be working atm. I'll give it another try. – humble_coder Jul 12 '09 at 03:01
0

What window do u mean ? modal window ? if u want to show some data through modal window, then i suggest u to use http://prototype-window.xilinus.com/index.html, it easier to use, just write some js function and create link_to_function in rails helper/view to call the js function.

gkrdvl
  • 960
  • 9
  • 20