I would like to have a button as follow:
[ Sign in with FB]
where FB is a font-awesome icon. I tried the following, but couldn't figure out how to embed the icon to the button:
= button_to "Login with", user_omniauth_authorize_path(:facebook)
Here is how font-awesome
is normally invoked (in haml):
%i.icon-facebook-sign
How do I achieve the effect I want?
Thank you.
You can pass a block to button_to
like so:
= button_to user_omniauth_authorize_path(:facebook) do
Login with
%i.icon-facebook-sign
(Though I'm not sure why you wouldn't just use the Facebook icon itself as the button.)
Add class option for button_to helper
= button_to "Login with", user_omniauth_authorize_path(:facebook), :class => 'icon-facebook-sign'
try this code, it runs for me
<%= button_to line_items_path(product_id: produit.id),class:"btn btn-outline-primary" do %>
<i class="fas fa-shopping-basket"></i>
<% end %>
just change the icon
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With