heartcombo / devise

Flexible authentication solution for Rails with Warden.
http://blog.plataformatec.com.br/tag/devise/
MIT License
23.89k stars 5.54k forks source link

Wiki: how about mentioning "Cancel my account" link? #5555

Closed JunichiIto closed 1 year ago

JunichiIto commented 1 year ago

Just suggestion, how about mentioning "Cancel my account" link in https://github.com/heartcombo/devise/wiki/How-To:-Upgrade-to-Devise-4.9.0-%5BHotwire-Turbo-integration%5D#data-confirm-vs-data-turbo-confirm ? Some people might want to provide "Cancel my account" link instead of button:

<%# works with rails-ujs but does not work with Turbo %>
<%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>

<%# works with Turbo but does not work with rails-ujs %>
<%= link_to "Cancel my account", registration_path(resource_name), data: { turbo_method: :delete, turbo_confirm: "Are you sure?" } %>

<%# works with both %>
<%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?", turbo_method: :delete, turbo_confirm: "Are you sure?" }, method: :delete %>

In addition, you might want to revert https://github.com/heartcombo/devise/pull/5554 and keep <p> tag...

<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?", turbo_method: :delete, turbo_confirm: "Are you sure?" }, method: :delete %></p>
Screenshot 2023-02-15 at 8 59 46
carlosantoniodasilva commented 1 year ago

I updated the wiki to mention both button_to and link_to so we can cover more ground in the examples there, appreciate the suggestion. 👍

I think we should stick to button_to in Devise for compatibility reasons, plus it's been like that for about 10 years now: https://github.com/heartcombo/devise/pull/2210, and I like the reasons for the original change explained in this comment there: use buttons for actions, links for navigation. Thanks!

JunichiIto commented 1 year ago

Thank you for your updating of wiki!

I like the reasons for the original change explained https://github.com/heartcombo/devise/pull/2210#issuecomment-12166270 there: use buttons for actions, links for navigation. Thanks!

I agree with the opinion too. 🙂