GlutVonSmark
GlutVonSmark

Reputation: 322

How to add img tags to button text using haml and erb button_to helper function

I have this piece of code (ruby haml)

= button_to tr('single_sign_on') , '/something/something0', method: :post, class: "btn-SSO"

Now I need to insert 2 icons to the button text. Any idea how to do that. I have zero experience with this tech & codebase. This doesn't have to use the button_to helper function. Can be just plain haml (i'm assuming I would have to wrap this in a form then).

Upvotes: 0

Views: 144

Answers (1)

andriy-baran
andriy-baran

Reputation: 739

This helper takes a block as a parameter where you can add icons https://apidock.com/rails/v5.2.3/ActionView/Helpers/UrlHelper/button_to

= button_to '/something/something0', method: :post, class: "btn-SSO" do
  = tr('single_sign_on')   
  i.fa.fa-save # example

Upvotes: 1

Related Questions