From 6ab5e708ec3846e611a4fc0edeb014ec8548059e Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 13 Dec 2022 15:46:17 +0100 Subject: [PATCH] [backend] prepare new page: controller, route, link and minimal template --- .../AccompanyingCourseWorkController.php | 22 ++++++++++++++++++ .../AccompanyingCourseWork/_item.html.twig | 7 +++++- .../AccompanyingCourseWork/edit.html.twig | 2 +- .../AccompanyingCourseWork/show.html.twig | 23 +++++++++++++++++++ .../translations/messages.fr.yml | 1 + 5 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/show.html.twig diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php index 7b77252be..6baaf03da 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php @@ -178,6 +178,28 @@ class AccompanyingCourseWorkController extends AbstractController ]); } + /** + * @Route( + * "{_locale}/person/accompanying-period/work/{id}/show", + * name="chill_person_accompanying_period_work_show", + * methods={"GET"} + * ) + */ + public function showWork(AccompanyingPeriodWork $work): Response + { + if (null === $work) { + throw $this->createNotFoundException('Unable to find Work entity.'); + } + + $this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::SEE, $work); + + return $this->render('@ChillPerson/AccompanyingCourseWork/show.html.twig', [ + 'accompanyingCourse' => $work->getAccompanyingPeriod(), + 'work' => $work, + ]); + + } + private function createDeleteForm(int $id): Form { $params = []; diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/_item.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/_item.html.twig index 3d4f46425..86e9e144c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/_item.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/_item.html.twig @@ -128,10 +128,15 @@ 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork', w.id, [], suppEvaluations) }} +
  • + +
  • {% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', w) %}
  • {% endif %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/edit.html.twig index d5ded06cf..0de5fcdb8 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/edit.html.twig @@ -9,7 +9,7 @@ {% endblock %} {% block content %} -
    +

    {{ block('title') }}

    diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/show.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/show.html.twig new file mode 100644 index 000000000..89aa98e46 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/show.html.twig @@ -0,0 +1,23 @@ +{% extends '@ChillPerson/AccompanyingCourse/layout.html.twig' %} + +{% block title 'accompanying_course_work.Show accompanying course work'|trans %} + +{% block css %} + {{ parent() }} +{% endblock %} + +{% block content %} +
    +

    {{ block('title') }}

    + {{ dump() }} + +
    +{% endblock %} + +{% block block_post_menu %} +
    +{% endblock %} + +{% block js %} + {{ parent() }} +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 7c9afba48..1e98ef35e 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -886,6 +886,7 @@ accompanying_course_work: create: Créer une action Create accompanying course work: Créer une action d'accompagnement Edit accompanying course work: Modifier une action d'accompagnement + Show accompanying course work: Action d'accompagnement List accompanying course work: Liste des actions d'accompagnement action: Action create_date: Date de création