Notifications list template

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

View File

@ -108,26 +108,28 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.notification { div.notification {
h6 { h2, h6 {
a {
text-decoration: none;
}
&::before { &::before {
font-family: "ForkAwesome"; font-family: "ForkAwesome";
font-size: 80%; font-size: 80%;
margin-right: 0.3em;
} }
} }
.read { div.read {
h6 { h2, h6 {
font-weight: 500; font-weight: 500;
&::before { &::before {
//content: "\f2b6"; //envelope-open
content: "\f2b7"; //envelope-open-o content: "\f2b7"; //envelope-open-o
} }
} }
} }
.unread { div.unread {
h6 { h2, h6 {
&::before { &::before {
//content: "\f0e0"; //envelope
content: "\f003"; //envelope-o content: "\f003"; //envelope-o
} }
} }

View File

@ -11,8 +11,7 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div class="row"> <div class="col-10">
<div class="col-md-10">
{% include handler.template(notification) with handler.templateData(notification) %} {% include handler.template(notification) with handler.templateData(notification) %}
{{ form_start(form, { 'attr': { 'id': 'notification' }}) }} {{ form_start(form, { 'attr': { 'id': 'notification' }}) }}
@ -22,6 +21,7 @@
{{ form_row(form.message) }} {{ form_row(form.message) }}
{{ form_end(form) }} {{ form_end(form) }}
<ul class="record_actions sticky-form-buttons"> <ul class="record_actions sticky-form-buttons">
<li class="cancel"> <li class="cancel">
<a href="{{ chill_return_path_or('chill_main_homepage') }}" class="btn btn-cancel">{{ 'Cancel'|trans|chill_return_path_label }}</a> <a href="{{ chill_return_path_or('chill_main_homepage') }}" class="btn btn-cancel">{{ 'Cancel'|trans|chill_return_path_label }}</a>
@ -30,7 +30,5 @@
<button type="submit" form="notification" class="btn btn-save">{{ 'Save'|trans }}</button> <button type="submit" form="notification" class="btn btn-save">{{ 'Save'|trans }}</button>
</li> </li>
</ul> </ul>
</div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -11,8 +11,7 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div class="row"> <div class="col-10">
<div class="col-md-10">
{% include handler.template(notification) with handler.templateData(notification) %} {% include handler.template(notification) with handler.templateData(notification) %}
{{ form_start(form, { 'attr': { 'id': 'notification' }}) }} {{ form_start(form, { 'attr': { 'id': 'notification' }}) }}
@ -22,6 +21,7 @@
{{ form_row(form.message) }} {{ form_row(form.message) }}
{{ form_end(form) }} {{ form_end(form) }}
<ul class="record_actions sticky-form-buttons"> <ul class="record_actions sticky-form-buttons">
<li class="cancel"> <li class="cancel">
<a href="{{ chill_return_path_or('chill_main_homepage') }}" class="btn btn-cancel">{{ 'Cancel'|trans|chill_return_path_label }}</a> <a href="{{ chill_return_path_or('chill_main_homepage') }}" class="btn btn-cancel">{{ 'Cancel'|trans|chill_return_path_label }}</a>
@ -30,7 +30,5 @@
<button type="submit" form="notification" class="btn btn-save">{{ 'Save'|trans }}</button> <button type="submit" form="notification" class="btn btn-save">{{ 'Save'|trans }}</button>
</li> </li>
</ul> </ul>
</div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -1,4 +1,4 @@
<div class="list-group notification my-2"> <div class="list-group my-2 notification notification-box">
<div class="list-group-item"> <div class="list-group-item">
<h4>{{ 'notification.Sent'|trans }}</h4> <h4>{{ 'notification.Sent'|trans }}</h4>
</div> </div>
@ -10,13 +10,13 @@
{% if notification.sender == app.user %} {% if notification.sender == app.user %}
<h6> <h6>
<abbr title="{{ 'Le ' ~ notification.date|format_date('long') }}" class="ms-1"> <abbr title="{{ 'Le ' ~ notification.date|format_date('long') ~ '\n' ~ notification.title }}">
{{ notification.date|format_datetime('short','short') }} {{ notification.date|format_datetime('short','short') }}
</abbr> </abbr>
{# Vue component #}
<span class="notification_toggle_read_status" <span class="notification_toggle_read_status"
data-notification-id="{{ notification.id }}" data-notification-id="{{ notification.id }}"
data-notification-current-is-read="{{ notification.isReadBy(app.user) }}" data-notification-current-is-read="{{ notification.isReadBy(app.user) }}"
data-show-button-url="{{ chill_path_add_return_path('chill_main_notification_show', {'id': notification.id}) }}" data-show-button-url="{{ chill_path_add_return_path('chill_main_notification_show', {'id': notification.id}) }}"
data-button-class="btn-outline-primary" data-button-class="btn-outline-primary"
data-button-text="false" data-button-text="false"

View File

@ -1,6 +1,6 @@
{% extends "@ChillMain/layout.html.twig" %} {% extends "@ChillMain/layout.html.twig" %}
{% block title 'notification.List'|trans %} {% block title 'notification.My own notifications'|trans %}
{% block js %} {% block js %}
{{ parent() }} {{ parent() }}
@ -13,12 +13,11 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div id="container content"> <div class="col-10 notification notification-list">
<div class="row">
<div class="grid-8 centered">
<h1>{{ block('title') }}</h1> <h1>{{ block('title') }}</h1>
<ul class="nav nav-tabs"> <ul class="nav nav-pills justify-content-center">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link {% if step == 'inbox' %}active{% endif %}" href="{{ path('chill_main_notification_my') }}"> <a class="nav-link {% if step == 'inbox' %}active{% endif %}" href="{{ path('chill_main_notification_my') }}">
{{ 'notification.Notifications received'|trans }} {{ 'notification.Notifications received'|trans }}
@ -57,47 +56,53 @@
<a href="{{ chill_path_add_return_path('chill_main_notification_show', {'id': notification.id}) }}"> <a href="{{ chill_path_add_return_path('chill_main_notification_show', {'id': notification.id}) }}">
{{ notification.title }} {{ notification.title }}
</a> </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> </h2>
</div> </div>
<div class="item-row"> <div class="item-row">
<div class="item-col"> <div class="item-col">
{% if step == 'inbox' and not notification.isSystem %} <div class="notification-from">
{{ 'notification.from'|trans }}: {{ notification.sender|chill_entity_render_string }} {% 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 %} {% else %}
&nbsp; <span class="badge-user system">{{ 'notification.is_system'|trans }}</span>
{% endif %}
{% endif %} {% endif %}
</div> </div>
<div class="item-col">{{ 'notification.adressees'|trans }} <div class="notification-to">
<ul> {% if notification.addressees|length > 0 %}
<abbr title="{{ 'notification.sent_to'|trans }}">
{{ 'notification.to'|trans }}:
</abbr>
{% endif %}
{% for a in notification.addressees %} {% for a in notification.addressees %}
<li> <span class="badge-user">
{{ a|chill_entity_render_string }} {{ a|chill_entity_render_string }}
</li> </span>
{% endfor %} {% endfor %}
</ul> </div>
</div> </div>
<div class="item-col">{{ notification.date|format_datetime('long', 'short') }}</div> <div class="item-col">{{ notification.date|format_datetime('long', 'short') }}</div>
</div> </div>
<div class="item-row"> <div class="item-row separator">
{% include data.template with data.template_data %}
</div>
<div class="item-row row">
<div> <div>
<blockquote class="chill-user-quote"> <blockquote class="chill-user-quote">
{{ notification.message|u.truncate(250, '…', false)|chill_markdown_to_html }} {{ notification.message|u.truncate(250, '…', false)|chill_markdown_to_html }}
</blockquote> </blockquote>
</div> </div>
</div> </div>
<div class="item-row separator">
{% include data.template with data.template_data %}
</div>
<div class="item-row separator"> <div class="item-row separator">
<ul class="record_actions"> <ul class="record_actions">
<li> <li>
{# Vue component #}
<span class="notification_toggle_read_status" <span class="notification_toggle_read_status"
data-notification-id="{{ notification.id }}" data-notification-id="{{ notification.id }}"
data-notification-current-is-read="{{ notification.isReadBy(app.user) }}" data-notification-current-is-read="{{ notification.isReadBy(app.user) }}"
@ -105,12 +110,14 @@
</li> </li>
{% if is_granted('CHILL_MAIN_NOTIFICATION_UPDATE', notification) %} {% if is_granted('CHILL_MAIN_NOTIFICATION_UPDATE', notification) %}
<li> <li>
<a href="{{ chill_path_add_return_path('chill_main_notification_edit', {'id': notification.id}) }}" class="btn btn-edit"></a> <a href="{{ chill_path_add_return_path('chill_main_notification_edit', {'id': notification.id}) }}"
class="btn btn-edit" title="{{ 'Edit'|trans }}"></a>
</li> </li>
{% endif %} {% endif %}
{% if is_granted('CHILL_MAIN_NOTIFICATION_SEE', notification) %} {% if is_granted('CHILL_MAIN_NOTIFICATION_SEE', notification) %}
<li> <li>
<a href="{{ chill_path_add_return_path('chill_main_notification_show', {'id': notification.id}) }}" class="btn btn-show"></a> <a href="{{ chill_path_add_return_path('chill_main_notification_show', {'id': notification.id}) }}"
class="btn btn-show" title="{{ 'Show'|trans }}"></a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -120,8 +127,5 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div>
</div>
{% endblock content %} {% endblock content %}

View File

@ -13,8 +13,8 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div class="row"> <div class="col-10">
<div class="col-md-10">
<h1>{{ notification.title }}</h1> <h1>{{ notification.title }}</h1>
<div> <div>
@ -88,12 +88,12 @@
</a> </a>
</li> </li>
<li> <li>
{# Vue component #}
<span class="notification_toggle_read_status" <span class="notification_toggle_read_status"
data-notification-id="{{ notification.id }}" data-notification-id="{{ notification.id }}"
data-notification-current-is-read="1" data-notification-current-is-read="1"
></span> ></span>
</li> </li>
</ul> </ul>
</div> </div>
</div>
{% endblock content %} {% endblock content %}

View File

@ -353,21 +353,24 @@ Created for: Créé pour
Created by: Créé par Created by: Créé par
notification: notification:
My own notifications: Mes notifications
Notify: Envoyer une notification Notify: Envoyer une notification
Notification created: Notification envoyée Notification created: Notification envoyée
Any notification received: Aucune notification reçue Any notification received: Aucune notification reçue
Any notification sent: Aucune notification envoyée Any notification sent: Aucune notification envoyée
Notifications received: Notifications reçues Notifications received: Notifications reçues
Notifications sent: Notification envoyées Notifications sent: Notifications envoyées
comment_appended: Commentaire ajouté comment_appended: Commentaire ajouté
append_comment: Ajouter un commentaire append_comment: Ajouter un commentaire
comment_updated: Commentaire mis à jour comment_updated: Commentaire mis à jour
is_unread: Non-lue is_unread: Non-lue
is_system: Notification automatique is_system: notification automatique
list: Notifications list: Notifications
Sent: Envoyé Sent: Envoyé
sent_to: Envoyé à to: À
sent_to: Destinataire(s)
from: De
received_from: Expéditeur
you were notified by %sender%: Vous avez été notifié par %sender% you were notified by %sender%: Vous avez été notifié par %sender%
you were notified by system: Vous avez été notifié automatiquement you were notified by system: Vous avez été notifié automatiquement
to: À

View File

@ -20,6 +20,11 @@ span.badge-thirdparty {
span.badge-user { span.badge-user {
border-bottom-width: 1px; border-bottom-width: 1px;
&.system {
background-color: $chill-llight-gray;
font-style: italic;
color: $chill-gray;
}
} }
span.badge-person { span.badge-person {
border-bottom-color: $chill-green; border-bottom-color: $chill-green;

View File

@ -2,7 +2,7 @@
{% if period is not null %} {% if period is not null %}
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', period) %} {% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', period) %}
<a href="{{ path('chill_person_accompanying_course_index', {'accompanying_period_id': notification.relatedEntityId }) }}"> <a href="{{ path('chill_person_accompanying_course_index', {'accompanying_period_id': notification.relatedEntityId }) }}">
Go to Acc. period. Show and Go to Accompanying Course
</a> </a>
{% else %} {% else %}
You are getting a notification for a period you are not allowed to see. This is the minimal details: {{ period.id }} You are getting a notification for a period you are not allowed to see. This is the minimal details: {{ period.id }}