From dece12c99bd41aa8a4587f58d8e2d30794cee151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9C=C3=A9?= Date: Fri, 24 Aug 2018 10:06:44 +0200 Subject: [PATCH] default confirm message when defined but not valued --- src/Resources/public/js/easyadmin-extension.js | 2 +- src/Resources/views/default/includes/_actions.html.twig | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Resources/public/js/easyadmin-extension.js b/src/Resources/public/js/easyadmin-extension.js index fd82db2..eb8a050 100644 --- a/src/Resources/public/js/easyadmin-extension.js +++ b/src/Resources/public/js/easyadmin-extension.js @@ -61,7 +61,7 @@ $(function() { var message = $(this).data('confirm'); var content = $('#modal-confirm p.modal-body-content'); - content.html(typeof message === "string" ? message : content.data('default')); + content.html(message); var confirmButton = $('#modal-confirm #modal-confirm-button'); if (!confirmButton.find('i').length) { confirmButton.prepend(''); } diff --git a/src/Resources/views/default/includes/_actions.html.twig b/src/Resources/views/default/includes/_actions.html.twig index c0c2883..a40d221 100644 --- a/src/Resources/views/default/includes/_actions.html.twig +++ b/src/Resources/views/default/includes/_actions.html.twig @@ -8,8 +8,8 @@ {% endif %} {% set confirm = false %} - {% if action.confirm is defined and action.confirm %} - {% set confirm = action.confirm %} + {% if action.confirm is defined %} + {% set confirm = action.confirm|default('confirm_modal.content'|trans(trans_parameters, 'EasyAdminBundle')) %} {% endif %}