Notifications list template

This commit is contained in:
2022-01-06 16:56:51 +01:00
parent 140f53b81f
commit c32b767d9b
9 changed files with 233 additions and 223 deletions

View File

@@ -1,6 +1,6 @@
{% extends "@ChillMain/layout.html.twig" %}
{% block title 'notification.List'|trans %}
{% block title 'notification.My own notifications'|trans %}
{% block js %}
{{ parent() }}
@@ -13,115 +13,119 @@
{% endblock %}
{% block content %}
<div id="container content">
<div class="row">
<div class="grid-8 centered">
<h1>{{ block('title') }}</h1>
<div class="col-10 notification notification-list">
<ul class="nav nav-tabs">
<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">
<a class="nav-link {% if step == 'sent' %}active{% endif %}" href="{{ path('chill_main_notification_sent') }}">
{{ 'notification.Notifications sent'|trans }}
{% if unreads['sent'] > 0 %}
<span class="badge rounded-pill bg-danger">
{{ unreads['sent'] }}
</span>
{% endif %}
</a>
</li>
</ul>
<h1>{{ block('title') }}</h1>
{% if datas|length == 0 %}
{% if step == 'inbox' %}
<p class="chill-no-data-statement">{{ 'notification.Any notification received'|trans }}</p>
{% else %}
<p class="chill-no-data-statement">{{ 'notification.Any notification sent'|trans }}</p>
{% endif %}
{% else %}
<div class="flex-table">
{% for data in datas %}
{% set notification = data.notification %}
<div class="item-bloc {% if not notification.isReadBy(app.user) %}unread{% else %}read{% endif %}">
<div class="item-row">
<h2>
<a href="{{ chill_path_add_return_path('chill_main_notification_show', {'id': notification.id}) }}">
{{ notification.title }}
</a>
{% if not notification.isReadBy(app.user) %}
<div class="badge bg-danger">{{ 'notification.is_unread'|trans }}</div>
{% endif %}
{% if notification.isSystem %}
<div class="badge bg-chill-green">{{ 'notification.is_system'|trans }}</div>
{% endif %}
</h2>
</div>
<div class="item-row">
<div class="item-col">
{% if step == 'inbox' and not notification.isSystem %}
{{ 'notification.from'|trans }}: {{ notification.sender|chill_entity_render_string }}
{% else %}
&nbsp;
{% endif %}
</div>
<div class="item-col">{{ 'notification.adressees'|trans }}
<ul>
{% for a in notification.addressees %}
<li>
{{ a|chill_entity_render_string }}
</li>
{% endfor %}
</ul>
</div>
<div class="item-col">{{ 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 separator">
{% include data.template with data.template_data %}
</div>
<div class="item-row separator">
<ul class="record_actions">
<li>
<span class="notification_toggle_read_status"
data-notification-id="{{ notification.id }}"
data-notification-current-is-read="{{ notification.isReadBy(app.user) }}"
></span>
</li>
{% if is_granted('CHILL_MAIN_NOTIFICATION_UPDATE', notification) %}
<li>
<a href="{{ chill_path_add_return_path('chill_main_notification_edit', {'id': notification.id}) }}" class="btn btn-edit"></a>
</li>
{% endif %}
{% if is_granted('CHILL_MAIN_NOTIFICATION_SEE', notification) %}
<li>
<a href="{{ chill_path_add_return_path('chill_main_notification_show', {'id': notification.id}) }}" class="btn btn-show"></a>
</li>
{% endif %}
</ul>
</div>
</div>
{% endfor %}
</div>
<ul class="nav nav-pills justify-content-center">
<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 %}
</div>
</a>
</li>
<li class="nav-item">
<a class="nav-link {% if step == 'sent' %}active{% endif %}" href="{{ path('chill_main_notification_sent') }}">
{{ 'notification.Notifications sent'|trans }}
{% if unreads['sent'] > 0 %}
<span class="badge rounded-pill bg-danger">
{{ unreads['sent'] }}
</span>
{% endif %}
</a>
</li>
</ul>
{% if datas|length == 0 %}
{% if step == 'inbox' %}
<p class="chill-no-data-statement">{{ 'notification.Any notification received'|trans }}</p>
{% else %}
<p class="chill-no-data-statement">{{ 'notification.Any notification sent'|trans }}</p>
{% endif %}
{% else %}
<div class="flex-table">
{% for data in datas %}
{% set notification = data.notification %}
<div class="item-bloc {% if not notification.isReadBy(app.user) %}unread{% else %}read{% endif %}">
<div class="item-row">
<h2>
<a href="{{ chill_path_add_return_path('chill_main_notification_show', {'id': notification.id}) }}">
{{ notification.title }}
</a>
</h2>
</div>
<div class="item-row">
<div class="item-col">
<div class="notification-from">
{% if step == 'inbox' %}
<abbr title="{{ 'notification.received_from'|trans }}">
{{ 'notification.from'|trans }}:
</abbr>
{% if not notification.isSystem %}
<span class="badge-user">
{{ notification.sender|chill_entity_render_string }}
</span>
{% else %}
<span class="badge-user system">{{ 'notification.is_system'|trans }}</span>
{% endif %}
{% endif %}
</div>
<div class="notification-to">
{% if notification.addressees|length > 0 %}
<abbr title="{{ 'notification.sent_to'|trans }}">
{{ 'notification.to'|trans }}:
</abbr>
{% endif %}
{% for a in notification.addressees %}
<span class="badge-user">
{{ a|chill_entity_render_string }}
</span>
{% endfor %}
</div>
</div>
<div class="item-col">{{ notification.date|format_datetime('long', 'short') }}</div>
</div>
<div class="item-row separator">
{% include data.template with data.template_data %}
</div>
<div class="item-row row">
<div>
<blockquote class="chill-user-quote">
{{ notification.message|u.truncate(250, '…', false)|chill_markdown_to_html }}
</blockquote>
</div>
</div>
<div class="item-row separator">
<ul class="record_actions">
<li>
{# Vue component #}
<span class="notification_toggle_read_status"
data-notification-id="{{ notification.id }}"
data-notification-current-is-read="{{ notification.isReadBy(app.user) }}"
></span>
</li>
{% if is_granted('CHILL_MAIN_NOTIFICATION_UPDATE', notification) %}
<li>
<a href="{{ chill_path_add_return_path('chill_main_notification_edit', {'id': notification.id}) }}"
class="btn btn-edit" title="{{ 'Edit'|trans }}"></a>
</li>
{% endif %}
{% if is_granted('CHILL_MAIN_NOTIFICATION_SEE', notification) %}
<li>
<a href="{{ chill_path_add_return_path('chill_main_notification_show', {'id': notification.id}) }}"
class="btn btn-show" title="{{ 'Show'|trans }}"></a>
</li>
{% endif %}
</ul>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
{% endblock content %}