Reputation: 530
Here is the code for my link:
<%=link_to "My Stations", retailer_my_stations_path%>
I want to style the link like:
<a class="dropdown-collapse" href="#"><i class='icon-edit'></i>
<span>My Stations</span>
</a>
How do I make Rails' link_to
helper use the Icon <i>
tag and the "My Stations" be inside the <span>
tag like in the theme?
Upvotes: 1
Views: 178
Reputation: 2878
link_to
can optionally take a block. You can add all html_options
in the html_options
key. I believe (but am not positive) that you reference the class directly.
I just use html_options
because it always works:
<% link_to(link_to "My Stations", retailer_my_stations_path, html_options: {class: "drop-down-collapse"} ) do %>
other tags i.e. span
<% end %>
Upvotes: 1