pyfedi/app/templates/chat/conversation.html

83 lines
4.3 KiB
HTML
Raw Normal View History

2024-02-17 20:05:57 +13:00
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
{% extends 'themes/' + theme() + '/base.html' %}
{% else %}
{% extends "base.html" %}
{% endif %} %}
2024-02-19 15:56:56 +13:00
{% set active_child = 'chats' %}
2024-02-17 20:05:57 +13:00
{% from 'bootstrap/form.html' import render_form %}
2024-02-19 15:01:53 +13:00
{% macro conversation_members(conversation) %}
{% if len(conversation.members) == 2 %}
{% for member in conversation.members %}
{% if member.id != current_user.id %}
2024-02-19 15:56:56 +13:00
<img src="{{ member.avatar_thumbnail() }}" loading="lazy" />
{% if not conversation.read %}<strong>{% endif %}
{{ member.display_name() }}
{% if not conversation.read %}</strong>{% endif %}
2024-02-19 15:01:53 +13:00
{% endif %}
{% endfor %}
{% else %}
{% for member in conversation.members %}
{% if member.id != current_user.id %}
2024-02-19 15:56:56 +13:00
{% if not conversation.read %}<strong>{% endif %}
{{ member.display_name() }}
{% if not conversation.read %}</strong>{% endif %}
2024-02-19 15:01:53 +13:00
{% endif %}
{% endfor %}
{% endif %}
{% endmacro %}
2024-02-17 20:05:57 +13:00
{% block app_content %}
<div class="row">
<div class="row">
<div class="col main_pane">
<nav aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li>
<li class="breadcrumb-item active">{{ _('Chat') }}</li>
</ol>
</nav>
2024-02-19 15:01:53 +13:00
<div class="row mt-3">
2024-02-17 20:05:57 +13:00
<div class="col col-md-2 d-none d-md-block sender_list">
<h3>{{ _('People') }}</h3>
<ul class="list-group list-group-flush">
2024-02-19 15:01:53 +13:00
{% for conversation in conversations %}
2024-02-17 20:05:57 +13:00
<li class="list-group-item">
2024-02-19 15:01:53 +13:00
{% if conversation.id == current_conversation %}
{{ conversation_members(conversation) }}
2024-02-17 20:05:57 +13:00
{% else %}
2024-02-19 15:01:53 +13:00
<a href="{{ url_for('chat.chat_home', conversation_id=conversation.id) }}">
{{ conversation_members(conversation) }}
2024-02-17 20:05:57 +13:00
</a>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
<div class="col col-md-10">
2024-02-19 15:01:53 +13:00
{% if messages %}
<h3 class="d-none d-md-inline">{{ _('Messages with %(name)s', name=conversation.member_names(current_user.id)) }}</h3>
2024-02-17 20:05:57 +13:00
<h3 class="d-md-none">{{ _('Messages with: ') }}
2024-02-19 15:01:53 +13:00
<select id="changeSender">{% for conversation in conversations %}
<option value="{{ conversation.id }}" {{ 'selected' if conversation.id == current_conversation }}>{{ conversation.member_names(current_user.id) }}</option>
2024-02-17 20:05:57 +13:00
{% endfor %}
</select></h3>
2024-02-19 15:01:53 +13:00
<div class="conversation mt-3">
2024-02-17 20:05:57 +13:00
{% for message in messages %}
<div id="message_{{ message.id }}" class="card message {{ 'from_other_party' if message.sender_id != current_user.id else 'from_me' }}">
<div class="message_body">
<span class="message_created_at text-muted small">{{ arrow.get(message.created_at).humanize(locale=locale) }}</span>
2024-02-19 15:01:53 +13:00
<span class="message_sender"><a href="/u/{{ message.sender.link() }}">{{ message.sender.display_name() }}</a></span>: {{ message.body_html|safe }}
2024-02-17 20:05:57 +13:00
</div>
</div>
{% endfor %}
{{ render_form(form) }}
2024-02-19 15:01:53 +13:00
<a class="conversation_options btn btn-outline-secondary" href="{{ url_for('chat.chat_options', conversation_id=current_conversation) }}" class="btn btn-outline-secondary">{{ _('Options') }}</a>
2024-02-17 20:05:57 +13:00
</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}