diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php index 65e83cdbc..06f0aa2b0 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php @@ -16,6 +16,7 @@ use Chill\PersonBundle\Form\AccompanyingCourseCommentType; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\HiddenType; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -27,7 +28,7 @@ use function array_key_exists; class AccompanyingCourseCommentController extends AbstractController { /** - * Comments page of Accompanying Course section. + * Page of comments in Accompanying Course section. * * @Route("/{_locale}/parcours/{accompanying_period_id}/comments", name="chill_person_accompanying_period_comment_list") * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) @@ -55,9 +56,10 @@ class AccompanyingCourseCommentController extends AbstractController } } - if (null === $editForm) { - throw new NotFoundHttpException('Unable to find an edit form.'); - } + dump($editForm); + //if (null === $editForm) { + // throw new NotFoundHttpException('Unable to find an edit form.'); + //} if ($request->getMethod() === Request::METHOD_POST) { $currentForm = $editForm->handleRequest($request); @@ -82,7 +84,7 @@ class AccompanyingCourseCommentController extends AbstractController ]); } - return $this->render('@ChillPerson/AccompanyingCourse/comment_list.html.twig', [ + return $this->render('@ChillPerson/AccompanyingCourse/Comment/index.html.twig', [ 'accompanyingCourse' => $accompanyingCourse, 'form' => $form->createView(), 'edit_form' => null !== $editForm ? $editForm->createView() : null, @@ -100,4 +102,40 @@ class AccompanyingCourseCommentController extends AbstractController return $form; } + +////////////// building +/// +// /** +// * Delete an existing comment +// * +// * @Route( +// * "/{_locale}/parcours/{accompanying_period_id}/comment/{comment_id}/delete", +// * name="chill_person_accompanying_period_comment_delete" +// * ) +// * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) +// * @ParamConverter("comment", options={"id": "comment_id"}) +// */ +// public function deleteAction(AccompanyingPeriod $accompanyingCourse, AccompanyingPeriod\Comment $comment, Request $request) +// { +// $form = $this->createDeleteForm($comment->getId(), $accompanyingCourse); +// +// return $this->render('@ChillPerson/AccompanyingCourse/Comment/confirm_delete.html.twig', [ +// 'comment' => $comment, +// 'delete_form' => $form->createView(), +// 'accompanyingCourse' => $accompanyingCourse, +// ]); +// } +// +// private function createDeleteForm(int $id, ?AccompanyingPeriod $accompanyingCourse): FormInterface +// { +// $form = $this->createForm($type); +// +// return $this->createFormBuilder() +// ->setAction($this->generateUrl('chill_person_accompanying_period_comment_delete', $params)) +// ->setMethod('DELETE') +// ->add('submit', SubmitType::class, ['label' => 'Delete']) +// ->getForm(); +// } +// +//// end } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/Comment/confirm_delete.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/Comment/confirm_delete.html.twig new file mode 100644 index 000000000..ecef5e271 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/Comment/confirm_delete.html.twig @@ -0,0 +1,20 @@ +{# WIP + +{% extends "@ChillPerson/Person/layout.html.twig" %} + +{% set person = activity.person %} + +{% block title 'Remove comment'|trans %} + +{% block personcontent %} + {{ include('@ChillMain/Util/confirmation_template.html.twig', + { + 'title' : 'Remove comment'|trans, + 'confirm_question' : 'Are you sure you want to remove comment ?'|trans, + 'cancel_route' : 'chill_activity_activity_list', + 'cancel_parameters' : { 'person_id' : activity.person.id, 'id' : activity.id }, + 'form' : delete_form + } ) }} +{% endblock %} + +#} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/comment_list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/Comment/index.html.twig similarity index 50% rename from src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/comment_list.html.twig rename to src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/Comment/index.html.twig index 9fc9a1c77..56dda187e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/comment_list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/Comment/index.html.twig @@ -4,42 +4,7 @@ {{ 'Accompanying Course Comment list'|trans }} {% endblock %} -{% macro show_comment(comment, options) %} -
{{ comment.content|chill_markdown_to_html }}-
{{ comment.content|chill_markdown_to_html }}+