notificaiton: add title to list and forms

This commit is contained in:
Julien Fastré 2022-01-04 11:32:15 +01:00
parent 0edd5667e0
commit 5bb5468198
6 changed files with 25 additions and 10 deletions

View File

@ -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,
])

View File

@ -17,6 +17,7 @@
{{ form_start(form, { 'attr': { 'id': 'notification' }}) }}
{{ form_row(form.title) }}
{{ form_row(form.addressees) }}
{{ form_row(form.message) }}

View File

@ -17,6 +17,7 @@
{{ form_start(form, { 'attr': { 'id': 'notification' }}) }}
{{ form_row(form.title) }}
{{ form_row(form.addressees) }}
{{ form_row(form.message) }}

View File

@ -53,16 +53,23 @@
{% set notification = data.notification %}
<div class="item-bloc {% if not notification.isReadBy(app.user) %}unread{% else %}read{% endif %}">
<div class="item-row">
<div>
<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 %}
</h2>
</div>
<div class="item-row">
<div class="item-col">
{% 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 class="item-col">{{ 'notification.adressees'|trans }}{% for a in notification.addressees %}{{ a|chill_entity_render_string }}{% if not loop.last %}, {% endif %}{% endfor %}</div>
<div class="item-col">{{ notification.date|format_datetime('long', 'short') }}</div>
</div>
<div class="item-row">
<div>
@ -71,10 +78,10 @@
</blockquote>
</div>
</div>
<div class="item-row">
<div class="item-row separator">
{% include data.template with data.template_data %}
</div>
<div class="item-row">
<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>

View File

@ -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 %}
<div class="row">
<div class="col-md-10">
<h1>{{ 'notification.Notification'|trans }}</h1>
<h1>{{ notification.title }}</h1>
<div>
{% include handler.getTemplate(notification) with handler.getTemplateData(notification) %}

View File

@ -361,4 +361,5 @@ notification:
Notifications sent: Notification envoyées
comment_appended: Commentaire ajouté
comment_updated: Commentaire mis à jour
is_unread: Non-lue