diff --git a/config/routes/actors.yaml b/config/routes/actors.yaml index 10af9e1..5e166d0 100644 --- a/config/routes/actors.yaml +++ b/config/routes/actors.yaml @@ -1,3 +1,6 @@ actors_actors: path: /actors - controller: App\Controller\ActorsController::actors \ No newline at end of file + controller: App\Controller\ActorsController::actors +actors_actor: + path: /actors/edit/{id} + controller: App\Controller\ActorsController::actor \ No newline at end of file diff --git a/src/Controller/ActorsController.php b/src/Controller/ActorsController.php index b681098..ee92c00 100644 --- a/src/Controller/ActorsController.php +++ b/src/Controller/ActorsController.php @@ -12,7 +12,7 @@ { /** - * Workspace selector page + * Actors management page * * @param Request $request * @return Response @@ -84,5 +84,27 @@ 'actors' => $actors, ]); } + + /** + * Actor edition page + * + * @param Request $request + * @param string $id + * @return Response + */ + public function actor(Request $request, string $id): Response + { + // Get repositories + $entityManager = $this->getDoctrine()->getManager(); + /** @var ActorRepository $actorRepository */ + $actorRepository = $entityManager->getRepository(ActorEntity::class); + + // Get actor + $actor = $actorRepository->find($id); + + return $this->render('actors/actor.html.twig', [ + 'actor' => $actor, + ]); + } } diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index 556b3ed..ef699f4 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -14,7 +14,7 @@ * @return Response */ public function home(): Response - { - return $this->render("home.html.twig"); + { + return $this->render('home.html.twig'); } } \ No newline at end of file diff --git a/templates/_includes/html/form/actors/delete.html.twig b/templates/_includes/html/form/actors/delete.html.twig index 176cdad..0859969 100644 --- a/templates/_includes/html/form/actors/delete.html.twig +++ b/templates/_includes/html/form/actors/delete.html.twig @@ -2,7 +2,7 @@ {{ form_widget(form.id, {'value': data.actor.id}) }} {% if data.variant|default('icon') == 'icon' %} {{ form_widget(form.submit, { - 'label': '', + 'label': 'Supprimer', 'label_html': true, 'attr': { 'class': 'icon-button', diff --git a/templates/actors/actor.html.twig b/templates/actors/actor.html.twig index e69de29..345d46a 100644 --- a/templates/actors/actor.html.twig +++ b/templates/actors/actor.html.twig @@ -0,0 +1,6 @@ +{% extends '_includes/html/base.html.twig' %} + +{% set page="Edition de l'acteur "~actor.displayName %} + +{% block pageContent %} +{% endblock %} \ No newline at end of file diff --git a/templates/actors/actors.html.twig b/templates/actors/actors.html.twig index 0b9e418..88e5438 100644 --- a/templates/actors/actors.html.twig +++ b/templates/actors/actors.html.twig @@ -16,7 +16,7 @@ Prénom Surnom Actif - + Actions @@ -26,8 +26,14 @@ {{ actor.lastName }} {{ actor.nickname }} {% if actor.active %} {% endif %} - {% include '_includes/html/genericForm.html.twig' with {'form': actorDeleteForm, 'data': {'actor': actor, 'variant': 'icon'}} only %} + class="icofont-checked color-green">Actif + {% endif %} + Editer + {% include '_includes/html/genericForm.html.twig' with {'form': actorDeleteForm, 'data': {'actor': actor, 'variant': 'icon'}} only %} + {% endfor %}