{% extends "base.html" %} {% load static %} {% block title %}Чат{% endblock %} {% block extra_css %}{% endblock %} {% block content %}
{% if chat.type == 'global' %}

Глобальный чат

{% elif chat.type == 'department' %}

Чат отдела: {{ chat.department.name }}

{% elif chat.type == 'announcement' %}

{{ chat.name|default:"Объявление" }}

{% if chat.is_blocked %} Заблокировано {% endif %} {% if not is_announcement_creator %} Только просмотр {% endif %} {% else %}

{% for u in chat.participants.all %} {% if u != user %} {% if not forloop.first %}, {% endif %} {{ u.get_full_name|default:u.username }} {% endif %} {% endfor %}

{% endif %}
{% if chat.type == 'announcement' and user.is_staff %} {% if chat.is_blocked %} {% else %} {% endif %} {% endif %} К чатам
{% if chat.is_blocked %} {% endif %} {% if chat.type == 'announcement' and not is_announcement_creator %} {% endif %}
Загружаем ранние сообщения…
{% if messages %} {% for message in messages %} {% ifchanged message.created_at|date:"d.m.Y" %}
{{ message.created_at|date:"d.m.Y" }}
{% endifchanged %}
{% if message.author_id != user.id %} {% if message.author.avatar %} {% else %}{% endif %} {% endif %}
{% if message.author_id == user.id %} Вы {% else %} {{ message.author.get_full_name|default:message.author.username }} {% endif %} ·
{% if message.content %} {{ message.content|linebreaksbr }} {% endif %} {% if message.has_attachments %}
{% for attachment in message.attachments.all %}
{% if attachment.file_type == 'image' %} {{ attachment.file_name }} {% elif attachment.file_type == 'audio' %}
{{ attachment.file_name }}
{% elif attachment.file_type == 'video' %}
{{ attachment.file_name }}
{% else %}
{{ attachment.file_name }}
{{ attachment.file_size|filesizeformat }}
{% endif %}
{% endfor %}
{% endif %}
{% if message.author_id == user.id %} {% if user.avatar %} {% else %}{% endif %} {% endif %}
{% endfor %} {% else %}
Пока нет сообщений.
{% endif %}
{% if can_send_messages %}
Собеседник печатает…
{% csrf_token %}
{% else %}

{% if chat.type == 'announcement' %} Только автор объявления может публиковать сообщения {% else %} У вас нет прав для отправки сообщений в этот чат {% endif %}

{% endif %}
{% endblock %} {% block extra_js %} {{ block.super }} {% endblock %}