src/Products/NotificationsBundle/Resources/views/dashboard/messages/includes/_message_details.html.twig line 1

Open in your IDE?
  1. {% set message = _args.message %}
  2. {% set preview = _args.preview|default(false) %}
  3. <div class="text-gray-dark">
  4.     {% include '@ProductsNotifications/dashboard/messages/includes/_message_detail.html.twig' with { message: message, preview: preview} %}
  5.     {% if message.media|length > 0 %}
  6.         <div class="pt-3 mb-4">
  7.             <h6>Image:</h6>
  8.             <div>
  9.                 <img class="img-fluid d-block" src="{{- (message.media.feature|decorate_media)._urls.medium -}}"
  10.                      width="231" alt="Facebook Preview"/>
  11.             </div>
  12.         </div>
  13.     {% endif %}
  14.     {% if  message.translations|length > 0 %}
  15.         <div class="d-flex align-items-center pt-3 pb-3 mb-4 mt-4">
  16.             <i class="icon-translations mr-3 pr-1 h1 mb-0"></i>
  17.             <span class="text-gray-dark text-semibold h3 mb-0">Translations</span>
  18.         </div>
  19.         {% for translation in message.translations %}
  20.             {% set locale = translation.locale %}
  21.             {% set humanReadableLocale = humanReadableLocales[locale] %}
  22.             <a class="lang_pill mb-2" href="#" data-locale="{{ locale }}" data-toggle="sidepanel"
  23.                data-target="{{ '#translation-sidepanel-' ~  locale }}">{{- humanReadableLocale -}}</a>
  24.             {% if preview %}
  25.                 {% embed '@ui2022/modal.html.twig' with {
  26.                     attr: {
  27.                         id: 'modal__email_preview_' ~ locale,
  28.                     },
  29.                 } %}
  30.                     {% block content %}
  31.                         {% embed '@ui2022/modal__content.html.twig' with {
  32.                             title: 'Email Preview',
  33.                         } %}
  34.                             {% block body %}
  35.                                 <iframe
  36.                                         id="preview-email-iframe{{ locale }}"
  37.                                         loading="lazy"
  38.                                         src="{{ path('app.notifications.dashboard.messages.email_preview', {message: message.id, school: (message.branding ? message.branding.id : 0), locale: locale}) }}"
  39.                                         frameborder="0"
  40.                                         style="width: 100%; height: 500px"
  41.                                 >
  42.                                 </iframe>
  43.                             {% endblock %}
  44.                         {% endembed %}
  45.                     {% endblock %}
  46.                 {% endembed %}
  47.             {% endif %}
  48.             {% embed '@ui2022/schoolnow/modal--sidepanel.html.twig' with {
  49.                 attr: {
  50.                     id: ('translation-sidepanel-' ~ locale),
  51.                     class: 'translation-sidepanel',
  52.                     'data-locale': locale,
  53.                 },
  54.             } %}
  55.                 {% block header %}
  56.                     <div class="sidepanel__head-left">
  57.                         <h2 class="text-an-demibold">{{ humanReadableLocale }}</h2>
  58.                     </div>
  59.                     <div class="sidepanel__head--right">
  60.                         {% include '@ui2022/button--button.html.twig' with {
  61.                             text: 'Hide',
  62.                             styles: 'lighter',
  63.                             attr: {
  64.                                 'data-dismiss': 'sidepanel',
  65.                             },
  66.                         } %}
  67.                     </div>
  68.                 {% endblock %}
  69.                 {% block content %}
  70.                     {% include '@ProductsNotifications/dashboard/messages/includes/_message_detail.html.twig' with { id: message.id, message: translation, locale: locale, preview: preview} %}
  71.                 {% endblock %}
  72.             {% endembed %}
  73.         {% endfor %}
  74.     {% endif %}
  75.     {% if preview %}
  76.         {% embed '@ui2022/modal.html.twig' with {
  77.             attr: {
  78.                 id: 'modal__email_preview',
  79.             },
  80.         } %}
  81.             {% block content %}
  82.                 {% embed '@ui2022/modal__content.html.twig' with {
  83.                     title: 'Email Preview',
  84.                 } %}
  85.                     {% block body %}
  86.                         <iframe
  87.                                 id="preview-email-iframe"
  88.                                 loading="lazy"
  89.                                 src="{{ path('app.notifications.dashboard.messages.email_preview', {message: message.id}) }}"
  90.                                 frameborder="0"
  91.                                 style="width: 100%; height: 500px"
  92.                         >
  93.                         </iframe>
  94.                     {% endblock %}
  95.                 {% endembed %}
  96.             {% endblock %}
  97.         {% endembed %}
  98.     {% endif %}
  99. </div>
  100. <script type="text/javascript">
  101.     (function (window, document, $, undefined) {
  102.         $(function () {
  103.             $('.translation-sidepanel').on('hidden.cs.sidepanel', function (e) {
  104.                 const audioPlayers = $(this).find('audio');
  105.                 for (let i = 0; i < audioPlayers.length; i++) {
  106.                     audioPlayers[i].pause();
  107.                     audioPlayers[i].currentTime = 0;
  108.                 }
  109.             });
  110.         });
  111.     })(window, document, jQuery);
  112. </script>