templates/partials/modal.html.twig line 1

Open in your IDE?
  1. <!-- templates/partials/modal.html.twig -->
  2. <div class="modal fade" id="feedbackModal" tabindex="-1" aria-labelledby="feedbackModalLabel" aria-hidden="true">
  3.     <div class="modal-dialog modal-dialog-centered">
  4.         <div class="modal-content">
  5.             <div class="modal-header">
  6.                 <h5 class="modal-title" id="feedbackModalLabel">Hinweis</h5>
  7.                 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  8.             </div>
  9.             <div class="modal-body">
  10.                 {% for message in app.flashes('success') %}
  11.                     <div class="alert alert-success">{{ message }}</div>
  12.                 {% endfor %}
  13.                 {% for message in app.flashes('error') %}
  14.                     <div class="alert alert-danger">{{ message }}</div>
  15.                 {% endfor %}
  16.             </div>
  17.             <div class="modal-footer">
  18.                 <button type="button" class="btn btn-primary" data-bs-dismiss="modal">OK</button>
  19.             </div>
  20.         </div>
  21.     </div>
  22. </div>
  23. <script>
  24.     document.addEventListener('DOMContentLoaded', function () {
  25.         // Prüfen, ob es Flash-Nachrichten für 'success' oder 'error' gibt
  26.         if (document.querySelectorAll('.alert').length > 0) {
  27.             var feedbackModal = new bootstrap.Modal(document.getElementById('feedbackModal'));
  28.             feedbackModal.show();
  29.         }
  30.     });
  31. </script>