From 374e05095089a94c7d21f81ca68a87cb048fc7b8 Mon Sep 17 00:00:00 2001 From: Sergio Vera Date: Sun, 31 Mar 2024 19:08:19 +0200 Subject: [PATCH] Use common delete modal also for home highlights --- internal/webserver/embedded/js/delete.js | 2 ++ internal/webserver/embedded/views/index.html | 2 +- internal/webserver/embedded/views/partials/delete-modal.html | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/webserver/embedded/js/delete.js b/internal/webserver/embedded/js/delete.js index c80b9f2..bce0546 100644 --- a/internal/webserver/embedded/js/delete.js +++ b/internal/webserver/embedded/js/delete.js @@ -3,6 +3,8 @@ // We use several conventions to be able to use the same code to delete different resources. // The link that initiates the action needs to have an attribute called data-id which must contain an unique identifier // for the resource to delete. +// This identifier well be sent to the backend controller specified in the form's action attribute +// under the name "id". // This code is designed to be used alongside partials/delete-modal.html const deleteModal = document.getElementById('delete-modal'); diff --git a/internal/webserver/embedded/views/index.html b/internal/webserver/embedded/views/index.html index 7d9bf5d..d4156f9 100644 --- a/internal/webserver/embedded/views/index.html +++ b/internal/webserver/embedded/views/index.html @@ -36,7 +36,7 @@

{{t .Lang "Your highlights" }}

{{end}} - {{template "partials/delete-modal" .}} + {{template "partials/delete-modal" dict "Lang" .Lang "Action" "/document" "ModalHeader" "Delete document" "ModalBody" "Are you sure you want to delete this document?" "ModalErrorMessage" "There was an error deleting the document"}} diff --git a/internal/webserver/embedded/views/partials/delete-modal.html b/internal/webserver/embedded/views/partials/delete-modal.html index b555be0..cb4f2f9 100644 --- a/internal/webserver/embedded/views/partials/delete-modal.html +++ b/internal/webserver/embedded/views/partials/delete-modal.html @@ -1,7 +1,7 @@