How to add CSS tips to link_to_remote?


#1

The following code of tag clouds implementation:
<%= link_to(h("<#{tag}>"), “tags/listmytag/#{tag}”, { :style =>
“font-size: #{font_size}” } ) -%>

I want to change it to ajax style:
<%= link_to_remote “<#{tag}>”,
{ :url => { :controller => ‘tags’, :action => ‘listmytag’, :id =>
“#{tag}” },
:update => “body”} %>
but I do not know how to add the “{ :style => “font-size: #{font_size}”
}” to link_to_remote to make the tags’ different font size of the tag
cloud.

Thanks
Charlie


#2

According to this:
http://api.rubyonrails.com/classes/ActionView/Helpers/PrototypeHelper.html#M000409

You can still pass in an HTML options hash, so you probably want:

<%= link_to_remote “<#{tag}>”,
{ :url => { :controller => ‘tags’, :action => ‘listmytag’, :id =>
“#{tag}” }, :update => “body”},
{ :style => “font-size: #{font_size}”}
%>

HTH,
David


#3

David T. wrote:

According to this:
http://api.rubyonrails.com/classes/ActionView/Helpers/PrototypeHelper.html#M000409

You can still pass in an HTML options hash, so you probably want:

<%= link_to_remote “<#{tag}>”,
{ :url => { :controller => ‘tags’, :action => ‘listmytag’, :id =>
“#{tag}” }, :update => “body”},
{ :style => “font-size: #{font_size}”}
%>

HTH,
David

Thanks,it get work!