From 126bd1a4eb3e82f747b5113307eb063f272ebc92 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 21 Jan 2022 12:07:54 +0100 Subject: [PATCH] fix for comment embeddable null + template adjustments --- .../Entity/Person/PersonResource.php | 5 +++ .../views/PersonResource/list.html.twig | 33 ++++++++++++++++--- .../translations/messages.fr.yml | 1 + 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php index d7b089598..3e4345a58 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php @@ -182,6 +182,11 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface public function setComment(?CommentEmbeddable $comment): self { + if ($comment === null) { + $this->comment->setComment(''); + return $this; + } + $this->comment = $comment; return $this; diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig index 1ed726477..7e1e191a8 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig @@ -17,24 +17,47 @@
{% if resource.person is not null %} -

{{ resource.person }}

+
+
+ {{ resource.person }} + {{ 'person'|trans|capitalize }} +
+
{% elseif resource.thirdparty is not null %} -

{{ resource.thirdparty }}

+
+
+ {{ resource.thirdparty }} + + {{ 'thirdparty'|trans|capitalize }} + + +
+
{% else %} -

{{ resource.freetext }}

+
+
+ {{ resource.freetext }} +
+
{% endif %}
- {{ resource.kind.title.fr }} + {% if resource.kind %} + {{ resource.kind.title.fr|capitalize }} + {% endif %}
-
+
+ {% if resource.kind %}
{{ resource.comment.comment }}
+ {% else %} +

{{ 'no comment found'|trans|capitalize }}

+ {% endif %}
diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index b58529b91..d0faba5b5 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -234,6 +234,7 @@ Are you sure you want to remove the resource for "%name%" ?: Étes-vous sûr de The resource has been successfully removed.: "La ressource a été supprimée." List of resources: "Liste des ressources" There are no available resources: "Il y aucun ressource" +no comment found: "Aucun commentaire" # pickAPersonType Pick a person: Choisir une personne