{% set message = _args.message %}
{% set preview = _args.preview|default(false) %}
<div class="text-gray-dark">
{% include '@ProductsNotifications/dashboard/messages/includes/_message_detail.html.twig' with { message: message, preview: preview} %}
{% if message.media|length > 0 %}
<div class="pt-3 mb-4">
<h6>Image:</h6>
<div>
<img class="img-fluid d-block" src="{{- (message.media.feature|decorate_media)._urls.medium -}}"
width="231" alt="Facebook Preview"/>
</div>
</div>
{% endif %}
{% if message.translations|length > 0 %}
<div class="d-flex align-items-center pt-3 pb-3 mb-4 mt-4">
<i class="icon-translations mr-3 pr-1 h1 mb-0"></i>
<span class="text-gray-dark text-semibold h3 mb-0">Translations</span>
</div>
{% for translation in message.translations %}
{% set locale = translation.locale %}
{% set humanReadableLocale = humanReadableLocales[locale] %}
<a class="lang_pill mb-2" href="#" data-locale="{{ locale }}" data-toggle="sidepanel"
data-target="{{ '#translation-sidepanel-' ~ locale }}">{{- humanReadableLocale -}}</a>
{% if preview %}
{% embed '@ui2022/modal.html.twig' with {
attr: {
id: 'modal__email_preview_' ~ locale,
},
} %}
{% block content %}
{% embed '@ui2022/modal__content.html.twig' with {
title: 'Email Preview',
} %}
{% block body %}
<iframe
id="preview-email-iframe{{ locale }}"
loading="lazy"
src="{{ path('app.notifications.dashboard.messages.email_preview', {message: message.id, school: (message.branding ? message.branding.id : 0), locale: locale}) }}"
frameborder="0"
style="width: 100%; height: 500px"
>
</iframe>
{% endblock %}
{% endembed %}
{% endblock %}
{% endembed %}
{% endif %}
{% embed '@ui2022/schoolnow/modal--sidepanel.html.twig' with {
attr: {
id: ('translation-sidepanel-' ~ locale),
class: 'translation-sidepanel',
'data-locale': locale,
},
} %}
{% block header %}
<div class="sidepanel__head-left">
<h2 class="text-an-demibold">{{ humanReadableLocale }}</h2>
</div>
<div class="sidepanel__head--right">
{% include '@ui2022/button--button.html.twig' with {
text: 'Hide',
styles: 'lighter',
attr: {
'data-dismiss': 'sidepanel',
},
} %}
</div>
{% endblock %}
{% block content %}
{% include '@ProductsNotifications/dashboard/messages/includes/_message_detail.html.twig' with { id: message.id, message: translation, locale: locale, preview: preview} %}
{% endblock %}
{% endembed %}
{% endfor %}
{% endif %}
{% if preview %}
{% embed '@ui2022/modal.html.twig' with {
attr: {
id: 'modal__email_preview',
},
} %}
{% block content %}
{% embed '@ui2022/modal__content.html.twig' with {
title: 'Email Preview',
} %}
{% block body %}
<iframe
id="preview-email-iframe"
loading="lazy"
src="{{ path('app.notifications.dashboard.messages.email_preview', {message: message.id}) }}"
frameborder="0"
style="width: 100%; height: 500px"
>
</iframe>
{% endblock %}
{% endembed %}
{% endblock %}
{% endembed %}
{% endif %}
</div>
<script type="text/javascript">
(function (window, document, $, undefined) {
$(function () {
$('.translation-sidepanel').on('hidden.cs.sidepanel', function (e) {
const audioPlayers = $(this).find('audio');
for (let i = 0; i < audioPlayers.length; i++) {
audioPlayers[i].pause();
audioPlayers[i].currentTime = 0;
}
});
});
})(window, document, jQuery);
</script>