notification: add show action

This commit is contained in:
2021-12-28 22:35:15 +01:00
parent f453dbb543
commit 1ad6a958e2
5 changed files with 133 additions and 13 deletions

View File

@@ -12,9 +12,11 @@
<li class="nav-item">
<a class="nav-link {% if step == 'inbox' %}active{% endif %}" href="{{ path('chill_main_notification_my') }}">
{{ 'notification.Notifications received'|trans }}
{% if unreads['inbox'] > 0 %}
<span class="badge rounded-pill bg-danger">
{{ unreads['inbox'] }}
</span>
{% endif %}
</a>
</li>
<li class="nav-item">
@@ -39,19 +41,35 @@
<div class="flex-table">
{% for data in datas %}
{% set notification = data.notification %}
<div class="item-row">
{% include data.template with data.template_data %}
</div>
<div class="item-row separator">
{% if step == 'inbox' %}
<div>{{ 'notification.from'|trans }}: {{ notification.sender|chill_entity_render_string }}</div>
{% endif %}
<div>{{ 'notification.adressees'|trans }}{% for a in notification.addressees %}{{ a|chill_entity_render_string }}{% if not loop.last %}, {% endif %}{% endfor %}</div>
<div>{{ notification.date|format_datetime('long', 'short') }}</div>
<div>
<blockquote class="chill-user-quote">
{{ notification.message|u.truncate(250, '…', false)|chill_markdown_to_html }}
</blockquote>
<div class="item-bloc {% if not notification.isReadBy(app.user) %}unread{% else %}read{% endif %}">
<div class="item-row">
<div>
{% if step == 'inbox' %}
{{ 'notification.from'|trans }}: {{ notification.sender|chill_entity_render_string }}
{% endif %}
{% if not notification.isReadBy(app.user) %}
<div class="badge bg-danger">{{ 'notification.is_unread'|trans }}</div>
{% endif %}
</div>
<div>{{ 'notification.adressees'|trans }}{% for a in notification.addressees %}{{ a|chill_entity_render_string }}{% if not loop.last %}, {% endif %}{% endfor %}</div>
<div>{{ notification.date|format_datetime('long', 'short') }}</div>
</div>
<div class="item-row">
<div>
<blockquote class="chill-user-quote">
{{ notification.message|u.truncate(250, '…', false)|chill_markdown_to_html }}
</blockquote>
</div>
</div>
<div class="item-row">
{% include data.template with data.template_data %}
</div>
<div class="item-row">
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_main_notification_show', {'id': notification.id}) }}" class="btn btn-show"></a>
</li>
</ul>
</div>
</div>
{% endfor %}

View File

@@ -0,0 +1,28 @@
{% extends "@ChillMain/layout.html.twig" %}
{% block title 'notification.show notification from %sender%'|trans({ '%sender%': notification.sender|chill_entity_render_string }) %}
{% block content %}
<div class="row">
<div class="col-md-10">
<h1>{{ 'notification.Notification'|trans }}</h1>
<div>
{% include handler.getTemplate(notification) with handler.getTemplateData(notification) %}
</div>
<div>
{# à remplacer par un commentEmbeddable #}
{{ notification.message|chill_markdown_to_html }}
</div>
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ chill_return_path_or('chill_main_notification_my') }}" class="btn btn-cancel">
{{ 'Cancel'|trans|chill_return_path_label }}
</a>
</li>
</ul>
</div>
</div>
{% endblock content %}