From 530267a9b0d4f1e3a448bf5af8bacb0635449d94 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 14 Dec 2021 10:25:36 +0100 Subject: [PATCH] commments: add basic form in template --- .../AccompanyingCourseController.php | 10 ++++++---- .../AccompanyingCourse/comment_list.html.twig | 19 +++++++++++++++++++ .../translations/messages.fr.yml | 4 ++++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php index dccf780d8..4495948fe 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -227,22 +227,24 @@ class AccompanyingCourseController extends Controller public function commentAction(AccompanyingPeriod $accompanyingCourse, Request $request): Response { -/* - $form = $this->createForm(AccompanyingCourseCommentType::class, $comment, []); + $comment = new AccompanyingPeriod\Comment(); + $form = $this->createForm(AccompanyingCourseCommentType::class, $comment, []); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $em = $this->getDoctrine()->getManager(); + $em->persist($comment); $em->flush(); + return $this->redirectToRoute($route); } -*/ + return $this->render('@ChillPerson/AccompanyingCourse/comment_list.html.twig', [ 'accompanyingCourse' => $accompanyingCourse, -// 'form' => $form->createView() + 'form' => $form->createView() ]); } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/comment_list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/comment_list.html.twig index 6f900dc05..514ca388d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/comment_list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/comment_list.html.twig @@ -29,6 +29,25 @@ {% block content %}

{{ block('title') }}

+ +
+ {{ form_start(form) }} + {{ form_errors(form) }} + + {{ form_widget(form.content) }} + +
    +
  • + + {# + + #} +
  • +
+ + {{ form_end(form) }} +
+
{% if accompanyingCourse.pinnedComment %} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 250890cd0..d8da74b14 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -407,9 +407,13 @@ Choose a person to locate by: Localiser auprès d'un usager concerné Associate at least one member with an household, and set an address to this household: Associez au moins un membre du parcours à un ménage, et indiquez une adresse à ce ménage. Locate by: Localiser auprès de fix it: Compléter + +# Accompanying Course comments Accompanying Course Comment: Commentaire Accompanying Course Comment list: Commentaires du parcours pinned: épinglé +Post a new comment: Poster un nouveau commentaire +Edit a comment: Modifier le commentaire # Household Household: Ménage