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

Add confirm prompt if turbo is available #498

Merged
merged 1 commit into from
Feb 19, 2025

Conversation

patriciomacadden
Copy link
Contributor

In the past, the scaffold generator added a confirm prompt to the destroy button. This PR adds it back only if Turbo is available.

@patriciomacadden
Copy link
Contributor Author

also adding cursor-pointer class to the destroy button as otherwise it'll show the normal cursor, which is odd for buttons.

Copy link
Member

@flavorjones flavorjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patriciomacadden Do we need to check if Turbo is available? What's the down side of always adding the data-turbo-confirm attribute?

It feels like unnecessary complexity, since I'm assuming that the attribute has no effect if Turbo is not present, but I'm not very familiar with turbo-rails so maybe I'm missing something.

Also, would you mind updating this PR to also include the destroy link merged from #461?

@patriciomacadden
Copy link
Contributor Author

@flavorjones i don't think there's a downside of adding data-turbo-confirm if turbo isn't present. It would be only a generated attribute that won't be used by anyone, but i don't think it's a problem. I thought it was clearer this way, but I can remove the check. No problem.

I'll also add the styles merged in #461 .

@flavorjones
Copy link
Member

woot!

@flavorjones flavorjones merged commit 8c1e12d into rails:main Feb 19, 2025
17 checks passed
@patriciomacadden patriciomacadden deleted the turbo-confirm-prompt branch February 19, 2025 17:47
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 this pull request may close these issues.

2 participants