Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add bootstrap's icon to button_to in rails3

My original code is

<%= button_to 'Destroy', girl, confirm: 'Are you sure?', :disable_with => 'deleting...', method: :delete, :class => 'btn-mini btn-danger btn'  %>

I'd like to add an icon in front of the word "Destroy".

icon tag is this

<i class="icon-pencil icon-white"></i>

How can I do that??

like image 688
MKK Avatar asked Jan 16 '23 03:01

MKK


1 Answers

Try using a block

<%= link_to girl, confirm: 'Are you sure?', disable_with: 'deleting...', method: :delete, class: 'btn-mini btn-danger btn' do %>
  <i class="icon-pencil icon-white"></i> Destroy
<% end %>

http://apidock.com/rails/v3.2.1/ActionView/Helpers/UrlHelper/button_to

http://apidock.com/rails/v3.2.1/ActionView/Helpers/UrlHelper/link_to

like image 89
house9 Avatar answered Jan 28 '23 20:01

house9