简体   繁体   中英

How to change tag font color?

Why is <%= raw averaged.tag_list.map { |t| link_to t.titleize, tagquantifieds_path(t) }.join(', ') %> <%= raw averaged.tag_list.map { |t| link_to t.titleize, tagquantifieds_path(t) }.join(', ') %> 's font color staying black instead of changing like the rest of <%= %> ?

How can we fix this? I'm sure its a simple answer I just couldn't find it on the web.

<div class="stats">
<ul>
<% @averaged_quantifieds.each do |averaged| %>

<% averaged.results.each do |result| %>
<% if result.good == true %>
<div class="green">

      <%= averaged.results.first.date_value.strftime("%b") %>:

      <%= raw averaged.tag_list.map { |t| link_to t.titleize, tagquantifieds_path(t) }.join(', ') %> 

      <%= averaged.results.first.result_value %>

      <%= averaged.metric %>

</div>

<% else %>
<div class="red">

      <%= averaged.results.first.date_value.strftime("%b") %>:

      <%= raw averaged.tag_list.map { |t| link_to t.titleize, tagquantifieds_path(t) }.join(', ') %> 

      <%= averaged.results.first.result_value %>

      <%= averaged.metric %>

</div>

<% end %>
<% end %>
<% end %>

Thanks for your help!

Because link_to is not styling, do this:

for red:

<%= raw averaged.tag_list.map { |t| link_to t.titleize, tagquantifieds_path(t), {:style=>'color:red;'}  }.join(', ') %> 

for green:

<%= raw averaged.tag_list.map { |t| link_to t.titleize, tagquantifieds_path(t), {:style=>'color:green;'}  }.join(', ') %> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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