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

Passing the element into $.rails.confirm #433

Open
brendon opened this issue Jul 10, 2015 · 0 comments
Open

Passing the element into $.rails.confirm #433

brendon opened this issue Jul 10, 2015 · 0 comments

Comments

@brendon
Copy link

brendon commented Jul 10, 2015

It seems strange to me that the triggering element isn't passed in the $.rails.confirm abstraction that was introduced here:

8063d1d

Right now, I override it like so:

$.rails.confirm = function(message) {
    return prompt(message + " Type DELETE in the box below and click OK to proceed.").toLowerCase() === 'delete'
  };

But this changes the behaviour for every instance of data-confirm on the page. It'd be nice to have the element passed so that one could adjust the behaviour. In this case, this extra layer of hardness to delete something isn't necessary for some things.

Have I missed a way to do this? Is it accessible through the $.rails object?

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

1 participant