templates/flash_messages.html.twig line 1

Open in your IDE?
  1. {% if app.session.flashbag.peek('success')|length %}
  2.     {% for message in app.flashes('success') %}
  3.         <script>
  4.             Swal.fire(
  5.                 '',
  6.                 '{{ message|raw }}',
  7.                 'success'
  8.             );
  9.         </script>
  10.     {% endfor %}
  11. {% endif %}
  12. {% if app.session.flashbag.peek('success_toast')|length %}
  13.     {% for message in app.flashes('success_toast') %}
  14.         <script>
  15.             Swal.fire({
  16.                 toast: true,
  17.                 position: 'top-end',
  18.                 showConfirmButton: false,
  19.                 timer: 1500,
  20.                 timerProgressBar: true,
  21.                 icon: 'success',
  22.                 html: '{{ message|raw }}'
  23.             });
  24.         </script>
  25.     {% endfor %}
  26. {% endif %}
  27. {% if app.session.flashbag.peek('error')|length %}
  28.     {% for message in app.flashes('error') %}
  29.         <script>
  30.             Swal.fire(
  31.                 '',
  32.                 '{{ message|raw }}',
  33.                 'error'
  34.             );
  35.         </script>
  36.     {% endfor %}
  37. {% endif %}
  38. {% if app.session.flashbag.peek('error_toast')|length %}
  39.     {% for message in app.flashes('error_toast') %}
  40.         <script>
  41.             Swal.fire({
  42.                 toast: true,
  43.                 position: 'top-end',
  44.                 showConfirmButton: false,
  45.                 timer: 1500,
  46.                 timerProgressBar: true,
  47.                 icon: 'error',
  48.                 html: '{{ message|raw }}'
  49.             });
  50.         </script>
  51.     {% endfor %}
  52. {% endif %}
  53. {% if app.session.flashbag.peek('warning')|length %}
  54.     {% for message in app.flashes('warning') %}
  55.         <script>
  56.             Swal.fire(
  57.                 '',
  58.                 '{{ message|raw }}',
  59.                 'warning'
  60.             );
  61.         </script>
  62.     {% endfor %}
  63. {% endif %}
  64. {% if app.session.flashbag.peek('warning_toast')|length %}
  65.     {% for message in app.flashes('warning_toast') %}
  66.         <script>
  67.             Swal.fire({
  68.                 toast: true,
  69.                 position: 'top-end',
  70.                 showConfirmButton: false,
  71.                 timer: 1500,
  72.                 timerProgressBar: true,
  73.                 icon: 'warning',
  74.                 html: '{{ message|raw }}'
  75.             });
  76.         </script>
  77.     {% endfor %}
  78. {% endif %}
  79. {% if app.session.flashbag.peek('info')|length %}
  80.     {% for message in app.flashes('info') %}
  81.         <script>
  82.             Swal.fire(
  83.                 '',
  84.                 '{{ message|raw }}',
  85.                 'info'
  86.             );
  87.         </script>
  88.     {% endfor %}
  89. {% endif %}
  90. {% if app.session.flashbag.peek('info_toast')|length %}
  91.     {% for message in app.flashes('info_toast') %}
  92.         <script>
  93.             Swal.fire({
  94.                 toast: true,
  95.                 position: 'top-end',
  96.                 showConfirmButton: false,
  97.                 timer: 1500,
  98.                 timerProgressBar: true,
  99.                 icon: 'info',
  100.                 html: '{{ message|raw }}'
  101.             });
  102.         </script>
  103.     {% endfor %}
  104. {% endif %}
  105. {% if app.session.flashBag.has(getParam('session_name')~'_cookies') %}
  106.     {% set message = '' %}
  107.     {% for msg in app.session.flashBag.get(getParam('session_name')~'_cookies') %}
  108.         {% set message = msg %}
  109.     {% endfor %}
  110.     <style>
  111.         ._swal_popup_custom {background: none;}
  112.         ._swal_blur_bg {backdrop-filter: blur(5px); background-color: rgba(0, 0, 0, 0.9)!important; z-index: 99999999999;}
  113.         @media (max-width: 430px) {
  114.             .swal2-html-container {margin: 0;}
  115.             ._wp_container  ._wp_msg_container {padding: 0!important;}
  116.             ._wp_container  ._wp_msg_container h2 {padding: 10px 20px 0 0;}
  117.             ._wp_container  ._wp_msg_container p {padding: 0 10px 10px 10px;}
  118.             ._wp_container  ._wp_TOS_content {padding: 0 5px!important;}
  119.         }
  120.     </style>
  121.     <div class="_cookies_content" style="display: none;">
  122.         {% include 'cookies_warning.html.twig' %}
  123.     </div>
  124.     <script>
  125.         $(document).ready(function(){
  126.             Swal.fire({
  127.                 title: '',
  128.                 html: $('._cookies_content').html(),
  129.                 showDenyButton: false,
  130.                 showConfirmButton: false,
  131.                 allowOutsideClick: false,
  132.                 showCloseButton: false,
  133.                 didOpen: () => {
  134.                     $('.swal2-popup').addClass('_swal_popup_custom');
  135.                     $('.swal2-backdrop-show').addClass('_swal_blur_bg');
  136.                     $('.swal2-close').blur();
  137.                     $('._wp_confirm').on('click', function(){
  138.                         $.cookie('{{ getParam('session_name') }}_cookies', 1, { path: '/', secure: true });
  139.                         Swal.close();
  140.                     });
  141.                     $('._wp_deny').on('click', function(){
  142.                         parent.location.href = 'https://www.google.com';
  143.                         Swal.close();
  144.                     });
  145.                 },
  146.                 willClose: () => {}
  147.             }).then(() => {});
  148.         });
  149.     </script>
  150. {% endif %}