Search code examples
htmlruby-on-railsslim-lang

Data disable with icon slim template


Working on a Rails app using slim. I have a problem passing html to slim on a button using data-disable-with attribute. I would like to show the icon on the button when someone clicks.

 = f.submit t("basket.next_step"), class: "btn btn-warning btn-lg btn-block", id: "submit_form", data: { disable_with: "<i class='fa fa-spinner fa-spin'></i>..."}

I have tried .html_safe but no luck. Please see similar questions but in .erb How to set html on data-disable-with to rails submit_tag and How to render HTML inside Slim templates for options i have tried.

Any help is greatly appreciated.


Solution

  • Try changing f.submit to f.button. The button tag handles markup differently than the submit tag.