If your page is in a Strict doctype, then you can''t use the target
attribute. (In a Transitional doctype, target="_blank" will give you
an endless succession of new windows, one for each link;
target="anything" will give you one new window over and over, with the
JavaScript name "anything", and it will keep re-using it.)
Instead, you have to use JavaScript to open the window. You can do
this inline, with
:onclick => ''window.open(this.href, "someName");''
or you can use another attribute as a hook for unobtrusive JavaScript.
I prefer the latter, and use
:rel => ''new_window''
and then
$$(''a[rel*="new_window"]).invoke(''observe'',''click'',function(evt){
evt.stop();
return window.open(this.href,''someName'');
});
Put that in a script block at the bottom of the page, or inside a
listener on the dom:loaded event, so it''s set up when the page loads.
Walter
On May 13, 2011, at 5:18 PM, TJ wrote:
> How can I insert (:popup => true) into code below?
>
> <%= link_to "Source_#{i}", link.url , :style =>
"color:#0096FF;font-
> family:''LucidaGrande'',''Lucida
Grande'',''Lucida Sans Unicode'',sans-
> serif; font-size: 11px; text-decoration: none; margin-right: 10px;" if
> link.show? %>
>
> --
> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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
> .
>
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.