mois3x / sweet-alert-rails-confirm

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

response from js.erb is not executed for remote link with ajax #8

Closed morismael closed 9 years ago

morismael commented 9 years ago

Hello,

First of all, thanks for this gem, it is really helpfull for making beautiful confirm for Rails apps.

I have an issue with it though: the gem seems to break Rails 4.0.2beta4 jquery UJS when used with link_to helper with remote: true. Clearly, the JS response returned by the server is not executed by the browser directly even though it can be executed in Firebug/Chrome console. I suspect this is due to the data-type option passed to the linkto helper, this may be confusing Rails and the request is treated as " /_ " and not as " JS ". A solution could be to rename the data-type option to something like data-sweet-alert-type and then pass that iption value to sweet-alert JS.

Could you fix this or help me by pointing me to the right place in the code where to test the idea?

Regards, Ismael

mois3x commented 9 years ago

Hi, thanks for the feedback, i just checked this and it seems to be what you said. The fix is in rename data-type indeed.

mois3x commented 9 years ago

https://github.com/mois3x/sweet-alert-rails-confirm/commit/65e259fcde0cf3238bd944d40816d1f741a2f14a could check this? @morismael

morismael commented 9 years ago

It works now! Many thanks. I have to continue testing, if I come across another issue I will let you know.