From 5bb54681987c3d30b0119c96fde3d692f57d3afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 4 Jan 2022 11:32:15 +0100 Subject: [PATCH] notificaiton: add title to list and forms --- .../ChillMainBundle/Form/NotificationType.php | 5 ++++ .../views/Notification/create.html.twig | 1 + .../views/Notification/edit.html.twig | 1 + .../views/Notification/list.html.twig | 23 ++++++++++++------- .../views/Notification/show.html.twig | 4 ++-- .../translations/messages.fr.yml | 1 + 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Form/NotificationType.php b/src/Bundle/ChillMainBundle/Form/NotificationType.php index 09d6a0341..b24513524 100644 --- a/src/Bundle/ChillMainBundle/Form/NotificationType.php +++ b/src/Bundle/ChillMainBundle/Form/NotificationType.php @@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\Notification; use Chill\MainBundle\Form\Type\ChillTextareaType; use Chill\MainBundle\Form\Type\PickUserDynamicType; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -23,6 +24,10 @@ class NotificationType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder + ->add('title', TextType::class, [ + 'label' => 'Title', + 'required' => true, + ]) ->add('addressees', PickUserDynamicType::class, [ 'multiple' => true, ]) diff --git a/src/Bundle/ChillMainBundle/Resources/views/Notification/create.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Notification/create.html.twig index db06caefa..edf9f3581 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Notification/create.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Notification/create.html.twig @@ -17,6 +17,7 @@ {{ form_start(form, { 'attr': { 'id': 'notification' }}) }} + {{ form_row(form.title) }} {{ form_row(form.addressees) }} {{ form_row(form.message) }} diff --git a/src/Bundle/ChillMainBundle/Resources/views/Notification/edit.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Notification/edit.html.twig index db06caefa..edf9f3581 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Notification/edit.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Notification/edit.html.twig @@ -17,6 +17,7 @@ {{ form_start(form, { 'attr': { 'id': 'notification' }}) }} + {{ form_row(form.title) }} {{ form_row(form.addressees) }} {{ form_row(form.message) }} diff --git a/src/Bundle/ChillMainBundle/Resources/views/Notification/list.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Notification/list.html.twig index 915f42c25..836883846 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Notification/list.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Notification/list.html.twig @@ -53,16 +53,23 @@ {% set notification = data.notification %}
-
+

+ + {{ notification.title }} + + {% if not notification.isReadBy(app.user) %} +
{{ 'notification.is_unread'|trans }}
+ {% endif %} +

+
+
+
{% if step == 'inbox' %} {{ 'notification.from'|trans }}: {{ notification.sender|chill_entity_render_string }} {% endif %} - {% if not notification.isReadBy(app.user) %} -
{{ 'notification.is_unread'|trans }}
- {% endif %}
-
{{ 'notification.adressees'|trans }}{% for a in notification.addressees %}{{ a|chill_entity_render_string }}{% if not loop.last %}, {% endif %}{% endfor %}
-
{{ notification.date|format_datetime('long', 'short') }}
+
{{ 'notification.adressees'|trans }}{% for a in notification.addressees %}{{ a|chill_entity_render_string }}{% if not loop.last %}, {% endif %}{% endfor %}
+
{{ notification.date|format_datetime('long', 'short') }}
@@ -71,10 +78,10 @@
-
+
{% include data.template with data.template_data %}
-
+
  • diff --git a/src/Bundle/ChillMainBundle/Resources/views/Notification/show.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Notification/show.html.twig index 4fa354e67..96357233a 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Notification/show.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Notification/show.html.twig @@ -1,6 +1,6 @@ {% extends "@ChillMain/layout.html.twig" %} -{% block title 'notification.show notification from %sender%'|trans({ '%sender%': notification.sender|chill_entity_render_string }) %} +{% block title 'notification.show notification from %sender%'|trans({ '%sender%': notification.sender|chill_entity_render_string })~' '~notification.title %} {% block js %} {{ parent() }} @@ -15,7 +15,7 @@ {% block content %}
    -

    {{ 'notification.Notification'|trans }}

    +

    {{ notification.title }}

    {% include handler.getTemplate(notification) with handler.getTemplateData(notification) %} diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index 2094e42fe..0bd15b74b 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -361,4 +361,5 @@ notification: Notifications sent: Notification envoyées comment_appended: Commentaire ajouté comment_updated: Commentaire mis à jour + is_unread: Non-lue