I would like to have a "Print" link which when clicked, calls my
print_list method to populate the print_list view, then opens the
print_list view in a NEW browser window. I''m using Firefox 1.5.0.9.
So far I have:
<%= link_to "Print", :action => ''print_list'',
:popup => true %>
This partially works - it calls the print_list method which properly
generates and populates the view. However, I can''t get it to come up in
a NEW window instead of overlaying my current window. I''ve tried
various permutations of braces and using variables instead of "true".
Here''s another example of what I''ve been trying:
<%= link_to "Print", {:action =>
''print_list''}, {:popup =>
[''new_window'', ''height=300,width=600'']}
%>
But how can I get a NEW window to pop up with my printable view in it?
Also, I''d like to have the File|Print dialog box automatically come up
when the new window opens. How do I get that to happen?
Thanks for the help,
Shauna
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On Fri, 2006-12-29 at 00:16 -0800, shauna wrote:> I would like to have a "Print" link which when clicked, calls my > print_list method to populate the print_list view, then opens the > print_list view in a NEW browser window. I''m using Firefox 1.5.0.9. > > So far I have: > <%= link_to "Print", :action => ''print_list'', :popup => true %> > > This partially works - it calls the print_list method which properly > generates and populates the view. However, I can''t get it to come up in > a NEW window instead of overlaying my current window. I''ve tried > various permutations of braces and using variables instead of "true". > Here''s another example of what I''ve been trying: > > <%= link_to "Print", {:action => ''print_list''}, {:popup => > [''new_window'', ''height=300,width=600'']} %> > > But how can I get a NEW window to pop up with my printable view in it? > > Also, I''d like to have the File|Print dialog box automatically come up > when the new window opens. How do I get that to happen?---- try <%= link_to "Print", , {:action => ''print_list'', :id => whatever.id}, :popup => [''new_window'', ''height=300,width=600''] %> Craig --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Craig, I tried your permutation and the results are no different. It displays the print_list view in the same browser tab, overwriting the original page. I want the original page to remain and the printable page to come up in a new browser window. By the way, my action doesn''t usea specific id - it''s just a list of the entire table in the order the user has picked. Shauna -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
This is an example from my current project that I know opens a new
window:
<%= link_to ''Preview'',{ :controller =>
''publish'', :action => ''preview'',
:id => page }, :popup => true %><br/>
If you don''t have an id then just leave it out.
If it is still displaying in the same browser tab then it is probably
your browser setting.
hope that helps -K
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Thanks, Kim. I tried fiddling with the Firefox settings and that made no difference. Other sites can open new windows from my browser so I know it can be done, but they use non-Rails methodology for that aspect. For example, the ZiYa plugin at http://liquidrail.com/ (recently announced on this list) opens a new window when I click on a chart image. Also, Google Docs and Spreadsheets at http://docs.google.com/ opens a new window to print a document. But I want to know how to do it within my Erb command so I don''t have to revert to pure JavaScript or use some other package! Shauna -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Fri, 2006-12-29 at 23:29 +0100, Shauna wrote:> Hi Craig, > > I tried your permutation and the results are no different. It displays > the print_list view in the same browser tab, overwriting the original > page. I want the original page to remain and the printable page to come > up in a new browser window. > > By the way, my action doesn''t usea specific id - it''s just a list of the > entire table in the order the user has picked.---- OK remove the id portion but I suspect that the reason that it isn''t popping up a window for you is that you need the javascripts library and thus need to include a layout that has <%javascript_include_tag :defaults %> in it. Craig --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Craig White wrote:> OK remove the id portion but I suspect that the reason that it isn''t > popping up a window for you is that you need the javascripts library and > thus need to include a layout that has <%> javascript_include_tag :defaults %> in it. > > CraigI do have <%= javascript_include_tag :defaults %> in my application.rhtml, and all the default js libs show up in the page source code for my page. I am also using rico.js. I tried removing that but it makes no difference to the popup window. Shauna --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---