I have a submit button on my form:
= semantic_form_for record do |form|
= form.actions do
= form.submit 'Save'
I want to add an icon from FontAwesome, with link_to
I can use a block:
= link_to record do
= fa_icon 'save'
Save
But this doesn't work with Formtastic's form.submit
.
I also tried:
= form.submit fa_icon('save')
= form.submit fa_icon('save').html_safe
But both renders escaped HTML.
How do I add a font-awesome icon to the <button>
tag?
Try using capture
to set a label, as in:
- label = capture do
= fa_icon 'save'
Save
= form.button label
This only seems to work for form.button
, but not for form.submit.
You'll have to use form.button label, type: :submit
.