8000 Batch action with turbolinks attaching click event twice · Issue #5553 · activeadmin/activeadmin · GitHub
[go: up one dir, main page]

Skip to content

Batch action with turbolinks attaching click event twice #5553

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

Closed
sgara opened this issue Nov 8, 2018 · 0 comments · Fixed by #5842
Closed

Batch action with turbolinks attaching click event twice #5553

sgara opened this issue Nov 8, 2018 · 0 comments · Fixed by #5842

Comments

@sgara
Copy link
Contributor
sgara commented Nov 8, 2018

Hi,
We'be been using activeadmin with turbolinks quite successfully for some time. While migrating to Turbolinks 5, I encountered an issue on batch actions : seems like both ready and turbolinks:load are trigger, which causes click handler to be attached twice.

I've recreated a simple project from scratch to check if that wasn't coming from our side and I do reproduce it. Basically just a brand new default rails app with activeadmin. Source code and live demo are available. Just go to admin/items directly, select items then Batch Actions > Delete Selected Items. The modal is then opened twice as you can see in this screenshot :
screenshot 2018-11-08 at 22 45 28

Looks like every version between 1.0.0 and 1.3.1 are affected (master might be as well). A possible solution would be to detach previously attached click handler here like this :

$('.batch_actions_selector li a').off('click').on 'click', (e)->

I'd be happy to do a PR if that solution seems acceptable. I'm open to other solutions/workarounds/.. as well.
Best!

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

Successfully merging a pull request may close this issue.

1 participant
0