Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable_with not properly render html code #489

Open
nut707 opened this issue Mar 24, 2017 · 3 comments
Open

Disable_with not properly render html code #489

nut707 opened this issue Mar 24, 2017 · 3 comments

Comments

@nut707
Copy link

nut707 commented Mar 24, 2017

=button_to 'Load users', users_load_from_bb_path, remote: true, class: 'btn btn-default', data: { disable_with: "<i class='fa fa-spinner fa-spin'></i> Loading..." }
All works fine, except spinner. It's rendered as raw code.

@sauy7
Copy link

sauy7 commented May 25, 2017

try: "<i class='fa fa-spinner fa-spin'></i> Loading...".html_safe

@thiensubs
Copy link

Try something like this:

= f.button "Log in", class: "button", data: {disable_with: ("<i class='fa fa-spinner fa-spin fa-circle-o-notch'> </i>  One moment please...").html_safe}

@ArturT
Copy link

ArturT commented Dec 25, 2017

I had the same problem but for simple_form.

If you use simple_form gem then f.button :submit does not work even with html_safe method. f.button :button on the other hand works and you don't need html_safe.

# does work
<%= f.button :button, 'Sign in', data: { disable_with: '<i class="fa fa-circle-o-notch fa-spin fa-fw"></i>' } %>

# does not work
<%= f.button :submit, value: 'Sign in', data: { disable_with: '<i class="fa fa-circle-o-notch fa-spin fa-fw"></i>'.html_safe } %>

I think we are good to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants