Merge branch '327_pinned_comment' into notification/completion

This commit is contained in:
2022-01-07 13:02:59 +01:00
5 changed files with 103 additions and 43 deletions

View File

@@ -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
}