Fix missing confirmation dialogs and methods on family invitation actions

This commit is contained in:
Eugene Burmakin 2025-11-07 12:19:05 +01:00
parent 313354bf7c
commit 7b9008445a
3 changed files with 7 additions and 5 deletions

View file

@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Taiwan flag is now shown on its own instead of in combination with China flag. - Taiwan flag is now shown on its own instead of in combination with China flag.
- On the registration page and other user forms, if something goes wrong, error messages are now shown to the user. - On the registration page and other user forms, if something goes wrong, error messages are now shown to the user.
- Leaving family, deleting family and cancelling invitations now prompt confirmation dialog to prevent accidental actions.
- Each pending family invitation now also contain a link to share with the invitee.
## Changed ## Changed

View file

@ -88,7 +88,7 @@
<% if policy(@family).destroy? %> <% if policy(@family).destroy? %>
<%= link_to family_path, <%= link_to family_path,
method: :delete, method: :delete,
data: { turbo_confirm: 'Are you sure you want to delete this family? This action cannot be undone.' }, data: { turbo_confirm: 'Are you sure you want to delete this family? This action cannot be undone.', turbo_method: :delete },
class: "btn btn-outline btn-error" do %> class: "btn btn-outline btn-error" do %>
<%= icon 'trash-2', class: "inline-block w-4" %> <%= icon 'trash-2', class: "inline-block w-4" %>
Delete Family Delete Family

View file

@ -26,7 +26,7 @@
<% if !current_user.family_owner? && current_user.family_membership %> <% if !current_user.family_owner? && current_user.family_membership %>
<%= link_to family_member_path(current_user.family_membership), <%= link_to family_member_path(current_user.family_membership),
method: :delete, method: :delete,
data: { turbo_confirm: 'Are you sure you want to leave this family?' }, data: { turbo_confirm: 'Are you sure you want to leave this family?', turbo_method: :delete },
class: "btn btn-outline btm-sm btn-warning" do %> class: "btn btn-outline btm-sm btn-warning" do %>
Leave Family Leave Family
<% end %> <% end %>
@ -35,7 +35,7 @@
<% if policy(@family).destroy? %> <% if policy(@family).destroy? %>
<%= link_to family_path, <%= link_to family_path,
method: :delete, method: :delete,
data: { turbo_confirm: 'Are you sure you want to delete this family? This action cannot be undone.' }, data: { turbo_confirm: 'Are you sure you want to delete this family? This action cannot be undone.', turbo_method: :delete },
class: "btn btn-outline btm-sm btn-error" do %> class: "btn btn-outline btm-sm btn-error" do %>
<%= icon 'trash-2', class: "inline-block w-4" %> <%= icon 'trash-2', class: "inline-block w-4" %>
Delete Delete
@ -190,9 +190,9 @@
</div> </div>
<% if policy(@family).manage_invitations? %> <% if policy(@family).manage_invitations? %>
<div class="ml-3"> <div class="ml-3">
<%= link_to family_invitation_path(invitation.token), <%= button_to family_invitation_path(invitation.token),
method: :delete, method: :delete,
data: { turbo_confirm: 'Are you sure you want to cancel this invitation?' }, form: { data: { turbo_confirm: 'Are you sure you want to cancel this invitation?', turbo_method: :delete } },
class: "btn btn-outline btn-warning btn-sm" do %> class: "btn btn-outline btn-warning btn-sm" do %>
Cancel Cancel
<% end %> <% end %>