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

Proposal: Adding Turbo.confirm for programmatic confirmation dialogs #1243

Open
janko opened this issue Apr 10, 2024 · 3 comments
Open

Proposal: Adding Turbo.confirm for programmatic confirmation dialogs #1243

janko opened this issue Apr 10, 2024 · 3 comments

Comments

@janko
Copy link

janko commented Apr 10, 2024

We're trying to completely replace @rails/ujs with Turbo in our app, and there are many programmatic calls to Rails.confirm which don't appear to have an equivalent in Turbo. It would be great if there was a Turbo.confirm method that just called the confirmMethod function.

@pokonski
Copy link

pokonski commented Apr 11, 2024

@janko
Copy link
Author

janko commented Apr 11, 2024

Registering the confirm function I know already, what I want is to later call that function from JavaScript (not via a click on [data-turbo-confirm] element).

In @rails/ujs, you can do Rails.confirm = but also Rails.confirm(...), which calls that registered function. It would be nice to be able to do that from Turbo, as then it would match the @rails/ujs convenience.

@johncalvinyoung
Copy link

@janko my company's library rolemodel/turbo-confirm supports programmatic access like that as of our recent v2.0 update.

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

No branches or pull requests

3 participants