Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add glyphicons to rails link_to helper - Bootstrap 3

I've been looking everywhere for a good explanation of how to add glyphicons to rails link_to and button_to helpers, but I've found very little. What I've gathered so far has led me to this:

<li>   <%= link_to deals_path, class: "btn btn-default" do %>     <%= content_tag(:i, "Dasboard",:class=>' glyphicon, glyphicon-th-large') -%>   <% end %> </li> 

This doesn't work though and I think the one example I found was from Bootstrap 2. Can anyone point me to a good resource on this, or provide a quick example? Thanks in advance!

like image 941
settheline Avatar asked Dec 20 '13 01:12

settheline


1 Answers

I found the answer to this here

The basic form of a glyph link in rails looks like this:

<%= link_to deals_path, class: "btn btn-default" do %>     <i class="glyphicon glyphicon-euro"></i> Dashboard <% end %> 

Modify as needed. The second example in that link didn't work for me, I assume because I'm using the rails_bootstrap_sass gem? Regardless, the above form worked for me.

like image 131
settheline Avatar answered Sep 24 '22 06:09

settheline