diff --git a/src/Resources/public/js/autocomplete-create.js b/src/Resources/public/js/autocomplete-create.js index daf1b97..0eaea54 100644 --- a/src/Resources/public/js/autocomplete-create.js +++ b/src/Resources/public/js/autocomplete-create.js @@ -57,7 +57,10 @@ function switchToEntityCreation(url_action, select_id, field_name) { } function openCreateEntityModal(data, url_action, field_name, select_id) { - $('#create-entity-modal .modal-body').html(data.html); + var data_html = $(data.html); + data_html.find('.form-actions > a[name=list]').remove(); + data_html.find('.form-actions > a[name=delete]').remove(); + $('#create-entity-modal .modal-body').html(data_html); $('form[name="'+field_name+'"]').attr('action', url_action); initCreateEntityAjaxForm(field_name, select_id); } @@ -95,6 +98,8 @@ function initCreateEntityAjaxForm(field_name, select_id) { }); } -$(function () { - createAutoCompleteCreateFields(); +window.addEventListener('load', function() { + $(function () { + createAutoCompleteCreateFields(); + }); }); diff --git a/src/Resources/public/js/easyadmin-extension.js b/src/Resources/public/js/easyadmin-extension.js index df6ccc7..3c5493c 100644 --- a/src/Resources/public/js/easyadmin-extension.js +++ b/src/Resources/public/js/easyadmin-extension.js @@ -52,25 +52,27 @@ function reloadEmbeddedList(identifier, toggleBaseUrl) { } } -$(function() { - $('[data-confirm]').on('click', function(e) { - e.preventDefault(); +window.addEventListener('load', function() { + $(function() { + $('[data-confirm]').on('click', function(e) { + e.preventDefault(); - var message = $(this).data('confirm'); - var content = $('#modal-confirm p.modal-body-content'); - content.html(message); + var message = $(this).data('confirm'); + var content = $('#modal-confirm p.modal-body-content'); + content.html(message); - var confirmButton = $('#modal-confirm #modal-confirm-button'); - if (!confirmButton.find('i').length) { confirmButton.prepend(''); } - confirmButton.find('i') - .removeClass() - .addClass($(this).find('i').attr('class')) - ; + var confirmButton = $('#modal-confirm #modal-confirm-button'); + if (!confirmButton.find('i').length) { confirmButton.prepend(''); } + confirmButton.find('i') + .removeClass() + .addClass($(this).find('i').attr('class')) + ; - var href = $(this).data('href'); - $('#modal-confirm #confirm-form').attr('action', href); + var href = $(this).data('href'); + $('#modal-confirm #confirm-form').attr('action', href); - $('#modal-confirm').modal({ backdrop: true, keyboard: true }); + $('#modal-confirm').modal({ backdrop: true, keyboard: true }); + }); }); }); diff --git a/src/Resources/views/default/new_ajax.html.twig b/src/Resources/views/default/new_ajax.html.twig index 1ca058a..3cf023a 100644 --- a/src/Resources/views/default/new_ajax.html.twig +++ b/src/Resources/views/default/new_ajax.html.twig @@ -2,9 +2,15 @@ {% block head_stylesheets %}