Using bootstrap icons with button_to “delete” in r

2020-02-07 05:30发布

I have this edit button:

<%= link_to edit_income_path(trans), class: "btn btn-default" do %>
<i class="glyphicon glyphicon-pencil"></i>
<% end %>

And I want a delete button to look the same with this icon: glyphicon glyphicon-trash, but I can't find the right syntax to make it work and look the same. My delete button now:

<%= button_to "delete", trans, :method=> :delete, :remote=> true %>

This is what it looks like

2条回答
放我归山
2楼-- · 2020-02-07 06:14

Is this what you are looking for??

<%= button_to trans, method: :delete, remote: true, class: "btn btn-default" do %>
  <span class="glyphicon glyphicon-trash"></span>
<% end %>
查看更多
乱世女痞
3楼-- · 2020-02-07 06:27

try this...for example with link_to

<%= link_to (‘<i class=“fa fa-thumbs-up fa-lg”> </i>’).html_safe, vote_path(@image), :method=> :delete, :remote=> true%>
查看更多
登录 后发表回答