From c9e8cc3530ba053ae22edde8ca3d14d1984936b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9C=C3=A9?= Date: Thu, 2 May 2019 18:11:05 +0200 Subject: [PATCH] Fix confirm-modal for post onload loaded content --- src/Resources/public/js/easyadmin-extension.js | 2 +- src/Resources/views/default/layout.html.twig | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Resources/public/js/easyadmin-extension.js b/src/Resources/public/js/easyadmin-extension.js index ec9e761..65dbd9a 100644 --- a/src/Resources/public/js/easyadmin-extension.js +++ b/src/Resources/public/js/easyadmin-extension.js @@ -66,7 +66,7 @@ function reloadEmbeddedList(identifier, toggleBaseUrl) { window.addEventListener('load', function() { $(function() { - $('[data-confirm]').on('click', function(e) { + $(document).on('click', '[data-confirm]', function(e) { e.preventDefault(); var message = $(this).data('confirm'); diff --git a/src/Resources/views/default/layout.html.twig b/src/Resources/views/default/layout.html.twig index 70d5c46..3615f5a 100644 --- a/src/Resources/views/default/layout.html.twig +++ b/src/Resources/views/default/layout.html.twig @@ -13,17 +13,19 @@ {% block wrapper %} {{ parent() }} - {% block confirm_modal %} - {{ include('@EasyAdmin/includes/_confirm_modal.html.twig', { + {% block create_entity_modal %} + {{ include('@EasyAdmin/includes/_create_entity_modal.html.twig', { _translation_domain: _entity_config.translation_domain|default(easyadmin_config('translation_domain')), _trans_parameters: _trans_parameters|default([]), }, with_context = false) }} - {% endblock confirm_modal %} + {% endblock create_entity_modal %} - {% block create_entity_modal %} - {{ include('@EasyAdmin/includes/_create_entity_modal.html.twig', { + {% block custom_modals '' %} + + {% block confirm_modal %} + {{ include('@EasyAdmin/includes/_confirm_modal.html.twig', { _translation_domain: _entity_config.translation_domain|default(easyadmin_config('translation_domain')), _trans_parameters: _trans_parameters|default([]), }, with_context = false) }} - {% endblock create_entity_modal %} + {% endblock confirm_modal %} {% endblock %}