From 117c276859c4ed744580af46997c4d7eff0d78da Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 3 Jan 2020 17:40:34 +0000 Subject: [PATCH] Bug 24341: Allow for more complex markup in OPAC confirmation dialogs This patch changes the globally-available confirmModal() function in the OPAC so that it uses jQuery's html() function for adding information to the confirmation modal's body. This will allow for more than just plain text to be added. This patch also removes some obsolete lines from the JavaScript in opac-user.tt and renames some variable for clarity. To test, apply the patch log in to the OPAC as a user who has holds and article requests. - Test the following interactions, both the confirmation and cancel options for each: - Cancel a hold - Suspend all holds - Resume all holds - Cancel an article request Signed-off-by: Maryse Simard Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt | 6 ++---- koha-tmpl/opac-tmpl/bootstrap/js/global.js | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index 96c494c949..879867af0a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -750,7 +750,6 @@ e.preventDefault(); var hold_title = $(this).data("title"); var reserve_id = $(this).data("reserve_id"); - var body = "

" + hold_title + "

"; confirmModal( hold_title, _("Are you sure you want to cancel this hold?"), _("Yes, cancel hold"), _("No, do not cancel hold"), function( result ){ if( result ){ $("#delete_hold_" + reserve_id ).submit(); @@ -761,10 +760,9 @@ $(".btn-delete-article-request").on("click", function(e){ e.preventDefault(); - var hold_title = $(this).data("title"); + var article_request = $(this).data("title"); var article_request_id = $(this).data("article-request_id"); - var body = "

" + hold_title + "

"; - confirmModal( hold_title, _("Are you sure you want to cancel this article request?"), _("Yes, cancel article request"), _("No, do not cancel article request"), function( result ){ + confirmModal( article_request, _("Are you sure you want to cancel this article request?"), _("Yes, cancel article request"), _("No, do not cancel article request"), function( result ){ if( result ){ $("#delete_article_request_" + article_request_id ).submit(); } diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/global.js b/koha-tmpl/opac-tmpl/bootstrap/js/global.js index 7f95b324ff..84ee7e844b 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/global.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/global.js @@ -82,7 +82,7 @@ function confirmModal(message, title, yes_label, no_label, callback) { } $("#bootstrap-confirm-box-modal .modal-header h4").text( title || "" ); - $("#bootstrap-confirm-box-modal .modal-body p").text( message || "" ); + $("#bootstrap-confirm-box-modal .modal-body").html( message || "" ); $("#bootstrap-confirm-box-modal-submit").text( yes_label || 'Confirm' ); $("#bootstrap-confirm-box-modal-cancel").text( no_label || 'Cancel' ); $("#bootstrap-confirm-box-modal").modal('show'); -- 2.39.5