engelsystem/resources/views/pages/messages/conversation.twig

63 lines
3.1 KiB
Twig
Raw Permalink Normal View History

{% extends "layouts/app.twig" %}
{% import 'macros/base.twig' as m %}
{% import 'macros/form.twig' as f %}
{% block title %}{{ __('message.title') }}: {{ other_user.displayName }}{% endblock %}
{% block content %}
<div class="container">
<div class="page-header">
<h1>
2024-05-22 18:29:32 +02:00
{{ m.back(url('/messages')) }}
{{ __('message.title') }}: {{ m.user(other_user, {'pronoun': true}) }}
</h1>
</div>
<div class="row">
<div class="col-12 col-lg-10 col-xl-8 offset-lg-1 offset-xl-2">
<div class="row conversation mb-2">
{% for msg in messages %}
{% set own_message = msg.user_id == user.id %}
<div class="col-12"{% if loop.last %} id="newest"{% endif %}>
<div class="d-flex{% if own_message %} justify-content-end{% endif %}">
<div class="card {% if own_message %}text-bg-primary{% else %}text-bg-secondary{% endif %} mb-3">
<div class="card-body">
<p class="card-text">{{ msg.text | nl2br }}</p>
</div>
<div class="card-footer d-flex justify-content-end align-items-center fw-light">
2023-11-23 14:30:46 +01:00
<small class="opacity-75">{{ msg.created_at.format(__('general.datetime')) }}</small>
{% if own_message %}
<form action="{{ url('/messages/' ~ other_user.id ~ '/' ~ msg.id) }}"
enctype="multipart/form-data" method="post" class="ms-2"
>
{{ csrf() }}
{{ f.delete(null, {'btn_type': 'sm btn-danger'}) }}
</form>
2022-06-04 22:42:52 +02:00
{% endif %}
</div>
{% if not own_message and msg.read == false %}
<span class="position-absolute top-0 start-100 translate-middle-x p-2 bg-danger rounded-circle"></span>
{% endif %}
2022-06-04 22:42:52 +02:00
</div>
</div>
</div>
{% endfor %}
</div>
<form action="" enctype="multipart/form-data" method="post">
{{ csrf() }}
<div class="input-group">
2023-12-16 03:07:16 +01:00
{{ f.textarea(
'text',
__('message.message'),
{'required': true, 'rows': 3, 'label_hidden': true, 'no_div': true}
) }}
{{ f.submit(m.icon('send-fill')) }}
</div>
</form>
</div>
</div>
</div>
{% endblock %}