From 8ba04b03305e2d1d4a1fc82cc97d63ea037289da Mon Sep 17 00:00:00 2001 From: Zach Gollwitzer Date: Mon, 11 Nov 2024 09:21:13 -0500 Subject: [PATCH] Fix confirm message --- app/javascript/controllers/application.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/javascript/controllers/application.js b/app/javascript/controllers/application.js index 6004862f..4b55996d 100644 --- a/app/javascript/controllers/application.js +++ b/app/javascript/controllers/application.js @@ -37,7 +37,17 @@ Turbo.setConfirmMethod((message) => { dialog.addEventListener( "close", () => { - resolve(dialog.returnValue === "confirm"); + const confirmed = dialog.returnValue === "confirm"; + + if (!confirmed) { + document.getElementById("turbo-confirm-title").innerHTML = + "Are you sure?"; + document.getElementById("turbo-confirm-body").innerHTML = + "You will not be able to undo this decision"; + document.getElementById("turbo-confirm-accept").innerHTML = "Confirm"; + } + + resolve(confirmed); }, { once: true }, );