From 4677bcc698d1f35c9a916b7fa6ca6f3782ef08ad Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Tue, 21 Oct 2025 20:01:13 +0200 Subject: [PATCH] Fix confirmation dialogs to show only once. --- CHANGELOG.md | 1 + app/views/devise/registrations/_api_key.html.erb | 2 +- app/views/devise/registrations/edit.html.erb | 2 +- app/views/exports/index.html.erb | 2 +- app/views/families/edit.html.erb | 2 +- app/views/families/show.html.erb | 6 +++--- app/views/imports/index.html.erb | 6 +++--- app/views/imports/show.html.erb | 2 +- app/views/notifications/show.html.erb | 2 +- app/views/places/index.html.erb | 2 +- app/views/points/index.html.erb | 6 +++--- app/views/settings/background_jobs/index.html.erb | 8 ++++---- 12 files changed, 21 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ba0a433..548b7c94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ In this release we're introducing family features that allow users to create fam - Sign out button works again. #1844 - Fixed user deletion bug where user could not be deleted due to counter cache on points. - Users always have default distance unit set to kilometers. #1832 +- All confirmation dialogs are now showing only once. ## Changed diff --git a/app/views/devise/registrations/_api_key.html.erb b/app/views/devise/registrations/_api_key.html.erb index 37daa7fd..b8396764 100644 --- a/app/views/devise/registrations/_api_key.html.erb +++ b/app/views/devise/registrations/_api_key.html.erb @@ -28,6 +28,6 @@

<%= api_v1_overland_batches_url(api_key: current_user.api_key) %>

- <%= link_to "Generate new API key", generate_api_key_path, data: { confirm: "Are you sure? This will invalidate the current API key.", turbo_confirm: "Are you sure?", turbo_method: :post }, class: 'btn btn-primary' %> + <%= link_to "Generate new API key", generate_api_key_path, data: { turbo_confirm: "Are you sure? This will invalidate the current API key.", turbo_method: :post }, class: 'btn btn-primary' %>

diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index eba1382b..257aba87 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -66,7 +66,7 @@ <%= render "devise/shared/links" %> <% end %> -

Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?", turbo_method: :delete }, method: :delete, class: 'btn' %>

+

Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { turbo_confirm: "Are you sure?", turbo_method: :delete }, method: :delete, class: 'btn' %>

<%= link_to "Export my data", export_settings_users_path, class: 'btn btn-primary', data: { diff --git a/app/views/exports/index.html.erb b/app/views/exports/index.html.erb index 25e94e5a..38761418 100644 --- a/app/views/exports/index.html.erb +++ b/app/views/exports/index.html.erb @@ -49,7 +49,7 @@ <%= link_to 'Download', export.url, class: "px-4 py-2 bg-blue-500 text-white rounded-md", download: export.name %> <% end %> <% end %> - <%= link_to 'Delete', export, data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?", turbo_method: :delete }, method: :delete, class: "px-4 py-2 bg-red-500 text-white rounded-md" %> + <%= link_to 'Delete', export, data: { turbo_confirm: "Are you sure?", turbo_method: :delete }, method: :delete, class: "px-4 py-2 bg-red-500 text-white rounded-md" %> <% end %> diff --git a/app/views/families/edit.html.erb b/app/views/families/edit.html.erb index 89451916..d06059c8 100644 --- a/app/views/families/edit.html.erb +++ b/app/views/families/edit.html.erb @@ -86,7 +86,7 @@ <% if policy(@family).destroy? %> <%= link_to family_path, method: :delete, - data: { confirm: 'Are you sure you want to delete this family? This action cannot be undone.', 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.' }, class: "btn btn-outline btn-error" do %> <%= icon 'trash-2', class: "inline-block w-4" %> Delete Family diff --git a/app/views/families/show.html.erb b/app/views/families/show.html.erb index bc221bf6..19c466d9 100644 --- a/app/views/families/show.html.erb +++ b/app/views/families/show.html.erb @@ -24,7 +24,7 @@ <% if !current_user.family_owner? && current_user.family_membership %> <%= link_to family_member_path(current_user.family_membership), method: :delete, - data: { confirm: 'Are you sure you want to leave this family?', turbo_confirm: 'Are you sure you want to leave this family?' }, + data: { turbo_confirm: 'Are you sure you want to leave this family?' }, class: "btn btn-outline btm-sm btn-warning" do %> Leave Family <% end %> @@ -33,7 +33,7 @@ <% if policy(@family).destroy? %> <%= link_to family_path, method: :delete, - data: { confirm: 'Are you sure you want to delete this family? This action cannot be undone.', 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.' }, class: "btn btn-outline btm-sm btn-error" do %> <%= icon 'trash-2', class: "inline-block w-4" %> Delete @@ -199,7 +199,7 @@

<%= link_to family_invitation_path(invitation.token), method: :delete, - data: { confirm: 'Are you sure you want to cancel this invitation?', turbo_confirm: 'Are you sure you want to cancel this invitation?' }, + data: { turbo_confirm: 'Are you sure you want to cancel this invitation?' }, class: "btn btn-outline btn-warning btn-sm" do %> Cancel <% end %> diff --git a/app/views/imports/index.html.erb b/app/views/imports/index.html.erb index cfcf0bef..8cf60feb 100644 --- a/app/views/imports/index.html.erb +++ b/app/views/imports/index.html.erb @@ -6,12 +6,12 @@ <%= link_to "New import", new_import_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %> <% if current_user.safe_settings.immich_url && current_user.safe_settings.immich_api_key %> - <%= link_to 'Import Immich data', settings_background_jobs_path(job_name: 'start_immich_import'), method: :post, data: { confirm: 'Are you sure?', turbo_confirm: 'Are you sure?', turbo_method: :post }, class: 'rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium' %> + <%= link_to 'Import Immich data', settings_background_jobs_path(job_name: 'start_immich_import'), method: :post, data: { turbo_confirm: 'Are you sure?', turbo_method: :post }, class: 'rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium' %> <% else %> Import Immich data <% end %> <% if current_user.safe_settings.photoprism_url && current_user.safe_settings.photoprism_api_key %> - <%= link_to 'Import Photoprism data', settings_background_jobs_path(job_name: 'start_photoprism_import'), method: :post, data: { confirm: 'Are you sure?', turbo_confirm: 'Are you sure?', turbo_method: :post }, class: 'rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium' %> + <%= link_to 'Import Photoprism data', settings_background_jobs_path(job_name: 'start_photoprism_import'), method: :post, data: { turbo_confirm: 'Are you sure?', turbo_method: :post }, class: 'rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium' %> <% else %> Import Photoprism data <% end %> @@ -75,7 +75,7 @@ <% if import.file.present? %> <%= link_to 'Download', rails_blob_path(import.file, disposition: 'attachment'), class: "btn btn-outline btn-sm btn-info", download: import.name %> <% end %> - <%= link_to 'Delete', import, data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?", turbo_method: :delete }, method: :delete, class: "btn btn-outline btn-sm btn-error" %> + <%= link_to 'Delete', import, data: { turbo_confirm: "Are you sure?", turbo_method: :delete }, method: :delete, class: "btn btn-outline btn-sm btn-error" %> <% end %> diff --git a/app/views/imports/show.html.erb b/app/views/imports/show.html.erb index 41fe784c..c92eeb2e 100644 --- a/app/views/imports/show.html.erb +++ b/app/views/imports/show.html.erb @@ -10,7 +10,7 @@ <%= link_to "Edit this import", edit_import_path(@import), class: "mt-2 rounded-lg py-3 px-5 bg-secondary-content inline-block font-medium" %>
- <%= link_to "Destroy this import", import_path(@import), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure? This action will delete all points imported with this file", turbo_method: :delete }, method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-secondary-content font-medium" %> + <%= link_to "Destroy this import", import_path(@import), data: { turbo_confirm: "Are you sure? This action will delete all points imported with this file", turbo_method: :delete }, method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-secondary-content font-medium" %>
<%= link_to "Back to imports", imports_path, class: "ml-2 rounded-lg py-3 px-5 bg-secondary-content inline-block font-medium" %>
diff --git a/app/views/notifications/show.html.erb b/app/views/notifications/show.html.erb index b2097882..20f51df7 100644 --- a/app/views/notifications/show.html.erb +++ b/app/views/notifications/show.html.erb @@ -5,7 +5,7 @@
<%= link_to "Back to notifications", notifications_path, class: "btn btn-small" %>
- <%= button_to "Destroy this notification", @notification, data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?", turbo_method: :delete }, method: :delete, class: "btn btn-small btn-warning" %> + <%= button_to "Destroy this notification", @notification, data: { turbo_confirm: "Are you sure?", turbo_method: :delete }, method: :delete, class: "btn btn-small btn-warning" %>
diff --git a/app/views/places/index.html.erb b/app/views/places/index.html.erb index fd899884..12195a81 100644 --- a/app/views/places/index.html.erb +++ b/app/views/places/index.html.erb @@ -41,7 +41,7 @@ <%= human_datetime(place.created_at) %> <%= "#{place.lat}, #{place.lon}" %> - <%= link_to 'Delete', place, data: { confirm: "Are you sure? Deleting a place will result in deleting all visits for this place.", turbo_confirm: "Are you sure? Deleting a place will result in deleting all visits for this place.", turbo_method: :delete }, method: :delete, class: "px-4 py-2 bg-red-500 text-white rounded-md" %> + <%= link_to 'Delete', place, data: { turbo_confirm: "Are you sure? Deleting a place will result in deleting all visits for this place.", turbo_method: :delete }, method: :delete, class: "px-4 py-2 bg-red-500 text-white rounded-md" %> <% end %> diff --git a/app/views/points/index.html.erb b/app/views/points/index.html.erb index 098d9860..66c1bf0b 100644 --- a/app/views/points/index.html.erb +++ b/app/views/points/index.html.erb @@ -28,12 +28,12 @@
- <%= link_to 'Export as GeoJSON', exports_path(start_at: @start_at, end_at: @end_at, file_format: :json), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure? This will start background process of exporting points within timeframe, selected between #{@start_at} and #{@end_at}", turbo_method: :post }, class: "btn border border-base-300 hover:btn-ghost" %> + <%= link_to 'Export as GeoJSON', exports_path(start_at: @start_at, end_at: @end_at, file_format: :json), data: { turbo_confirm: "Are you sure? This will start background process of exporting points within timeframe, selected between #{@start_at} and #{@end_at}", turbo_method: :post }, class: "btn border border-base-300 hover:btn-ghost" %>
- <%= link_to 'Export as GPX', exports_path(start_at: @start_at, end_at: @end_at, file_format: :gpx), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure? This will start background process of exporting points within timeframe, selected between #{@start_at} and #{@end_at}", turbo_method: :post }, class: "btn border border-base-300 hover:btn-ghost" %> + <%= link_to 'Export as GPX', exports_path(start_at: @start_at, end_at: @end_at, file_format: :gpx), data: { turbo_confirm: "Are you sure? This will start background process of exporting points within timeframe, selected between #{@start_at} and #{@end_at}", turbo_method: :post }, class: "btn border border-base-300 hover:btn-ghost" %>
@@ -47,7 +47,7 @@
<%= form_with url: bulk_destroy_points_path(params.permit!), method: :delete, id: :bulk_destroy_form do |f| %>
- <%= f.submit "Delete Selected", class: "px-4 py-2 bg-red-500 text-white rounded-md", data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?", checkbox_select_all_target: "deleteButton" }, style: "display: none;" %> + <%= f.submit "Delete Selected", class: "px-4 py-2 bg-red-500 text-white rounded-md", data: { turbo_confirm: "Are you sure?", checkbox_select_all_target: "deleteButton" }, style: "display: none;" %>
<%= page_entries_info @points, entry_name: 'point' %>
diff --git a/app/views/settings/background_jobs/index.html.erb b/app/views/settings/background_jobs/index.html.erb index 22813e2a..f9adcb00 100644 --- a/app/views/settings/background_jobs/index.html.erb +++ b/app/views/settings/background_jobs/index.html.erb @@ -25,7 +25,7 @@

Start Reverse Geocoding

This job will re-run reverse geocoding process for all the points in your database. Might take a few days or even weeks based on the amount of points you have!

- <%= link_to 'Start Job', settings_background_jobs_path(job_name: 'start_reverse_geocoding'), method: :post, data: { confirm: 'Are you sure?', turbo_confirm: 'Are you sure?', turbo_method: :post }, class: 'btn btn-primary' %> + <%= link_to 'Start Job', settings_background_jobs_path(job_name: 'start_reverse_geocoding'), method: :post, data: { turbo_confirm: 'Are you sure?', turbo_method: :post }, class: 'btn btn-primary' %>
@@ -35,7 +35,7 @@

Continue Reverse Geocoding

This job will process reverse geocoding for all points that don't have geocoding data yet.

- <%= link_to 'Start Job', settings_background_jobs_path(job_name: 'continue_reverse_geocoding'), method: :post, data: { confirm: 'Are you sure?', turbo_confirm: 'Are you sure?', turbo_method: :post }, class: 'btn btn-primary' %> + <%= link_to 'Start Job', settings_background_jobs_path(job_name: 'continue_reverse_geocoding'), method: :post, data: { turbo_confirm: 'Are you sure?', turbo_method: :post }, class: 'btn btn-primary' %>
@@ -56,9 +56,9 @@

Enable or disable visits suggestions. It's a background task that runs every day at midnight. Disabling it might be useful if you don't want to receive visits suggestions or if you're using the Dawarich iOS app, which has its own visits suggestions.

<% if current_user.safe_settings.visits_suggestions_enabled? %> - <%= link_to 'Disable', settings_path(settings: { 'visits_suggestions_enabled' => 'false' }), method: :patch, data: { confirm: 'Are you sure?', turbo_confirm: 'Are you sure?', turbo_method: :patch }, class: 'btn btn-error' %> + <%= link_to 'Disable', settings_path(settings: { 'visits_suggestions_enabled' => 'false' }), method: :patch, data: { turbo_confirm: 'Are you sure?', turbo_method: :patch }, class: 'btn btn-error' %> <% else %> - <%= link_to 'Enable', settings_path(settings: { 'visits_suggestions_enabled' => 'true' }), method: :patch, data: { confirm: 'Are you sure?', turbo_confirm: 'Are you sure?', turbo_method: :patch }, class: 'btn btn-success' %> + <%= link_to 'Enable', settings_path(settings: { 'visits_suggestions_enabled' => 'true' }), method: :patch, data: { turbo_confirm: 'Are you sure?', turbo_method: :patch }, class: 'btn btn-success' %> <% end %>