mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
wip delete comment
This commit is contained in:
parent
5fead5b467
commit
68ea0a1086
@ -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"})
|
||||
@ -101,4 +102,39 @@ 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/confirm_delete_comment.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
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
{% 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 %}
|
Loading…
x
Reference in New Issue
Block a user