integreat_cms/cms/templates/chat/_chat_messages.html
{% load i18n %}
{% load static %}
{% load rules %}
{% for message in chat_messages %}
<div class="chat-message p-2 {% if not forloop.last or not chat_form %}border-t border-gray-300{% endif %} {% if chat_last_visited < message.sent_datetime %}bg-border-left from-yellow-400 to-yellow-100{% endif %}">
{% if message.sender.is_superuser or message.sender.is_staff %}
<span class="inline-block h-5 w-5 align-text-top bg-integreat-icon bg-contain bg-center bg-no-repeat"></span>
{% endif %}
<span class="font-bold">{{ message.sender.full_user_name }}</span>
{% if message.sender.email %}
({{ message.sender.email|urlize }})
{% endif %}
{% has_perm 'cms.delete_chat_message_object' request.user message as can_delete_message %}
{# djlint:off #}
<button title="{% translate "Delete chat message" %}"
class="{% if not can_delete_message %} invisible{% endif %} button-delete-chat-message btn-icon float-right ml-2"
data-confirmation-title="{% translate "Please confirm that you really want to delete this chat message:" %}"
data-confirmation-text='{% translate "Sender:" %} {{ message.sender.full_user_name }}
{% translate "Sent on:" %} {{ message.sent_datetime }}'
data-confirmation-subject="{{ message.text }}"
data-action="{% spaceless %} {% if request.region %} {% url "delete_chat_message" region_slug=request.region.slug message_id=message.id %} {% else %} {% url "delete_chat_message" message_id=message.id %} {% endif %} {% endspaceless %}">
<i icon-name="trash-2"></i>
</button>
{# djlint:on #}
<span class="text-gray-600 float-right">{{ message.sent_datetime }}</span>
<p class="pt-2 whitespace-pre-line">
{{ message.text|urlize }}
</p>
</div>
{% endfor %}