mois3x / sweet-alert-rails-confirm

A Rails confirm replacement with SweetAlert
MIT License
73 stars 50 forks source link

Initialize confirm dialogs on `page:update` Turbolinks 5 event #36

Closed jmbejar closed 8 years ago

jmbejar commented 8 years ago

Initialize confirm dialogs on page:update Turbolinks event

It fixes sweet alert confirm dialogs when the button or link was added to the DOM using partial replacements (Turbolinks 5).

Please note this event is fired when the page is loaded and also when the a partial replacement is made. Therefore, using this event instead of page:load covers more cases.

Users using Turbolinks 2.x should not be affected by the change, since the page:update event is also triggered just before page:load in this version.

PS Maybe this change fixes https://github.com/mois3x/sweet-alert-rails-confirm/issues/11?

mois3x commented 8 years ago

Thanks. I think it could fix #11 too if the bug remain there.