Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Icon tag <i> in remote ajax call in rails

i want to use the new Icon tag from bootstrap css to make a remote call in rails 3.1.1

Here is my original code:

<%=link_to(image_tag("/assets/icons/sub_blue_down.png", :class => "points_arrow"),        
vote_down_politician_path(pending_discussions, :politician_id  =>   
pending_discussions.politician_id), :remote=> true, :method => :post) %>

I want to use this:

<i class="icon-minus-sign"></i>

Instead of the image tag

Here is my attempt but doesn't work:

<%= link_to  ' <i class="icon-plus-sign"></i>', 
vote_up_politician_path(pending_discussions, :politician_id  =>    
pending_discussions.politician_id), :remote=> true, :method => :post%>
like image 501
limo2009 Avatar asked Feb 22 '23 14:02

limo2009


1 Answers

You should be using this syntax instead:

<%= link_to vote_up_politician_path(pending_discussions, :politician_id  =>    
pending_discussions.politician_id), :remote=> true, :method => :post do%>
  <i class="icon-plus-sign"></i>
<% end %>

More info: http://apidock.com/rails/ActionView/Helpers/UrlHelper/link_to

like image 68
iwasrobbed Avatar answered Mar 03 '23 10:03

iwasrobbed