From 905829fb599358b8981b0573d92ad7322c6840a7 Mon Sep 17 00:00:00 2001 From: Aymeric SERRA Date: Thu, 9 Feb 2023 09:07:28 +0100 Subject: [PATCH 1/4] Deplacement de navbar dans son propre fichier --- templates/base.html.twig | 33 ++++----------------------- templates/components/navbar.html.twig | 27 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 28 deletions(-) create mode 100644 templates/components/navbar.html.twig diff --git a/templates/base.html.twig b/templates/base.html.twig index 68885be..c1ab4bc 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -16,34 +16,11 @@ {% endblock %} - +
+ {% block topnavbar %} + {{ include('components/navbar.html.twig') }} + {% endblock %} +
{% block body %}{% endblock %} diff --git a/templates/components/navbar.html.twig b/templates/components/navbar.html.twig new file mode 100644 index 0000000..d157ffb --- /dev/null +++ b/templates/components/navbar.html.twig @@ -0,0 +1,27 @@ + \ No newline at end of file From 675e6dac8a327b9ebd73b67d708639f1dcf771a0 Mon Sep 17 00:00:00 2001 From: Aymeric SERRA Date: Thu, 9 Feb 2023 09:13:18 +0100 Subject: [PATCH 2/4] =?UTF-8?q?Ajout=20d'une=20route=20byme=20aux=20atelie?= =?UTF-8?q?rs=20pour=20voir=20les=20ateliers=20cr=C3=A9=C3=A9=20par=20l'ut?= =?UTF-8?q?ilisateur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controller/AtelierController.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Controller/AtelierController.php b/src/Controller/AtelierController.php index 60b4781..711ce0e 100644 --- a/src/Controller/AtelierController.php +++ b/src/Controller/AtelierController.php @@ -23,6 +23,16 @@ class AtelierController extends AbstractController ]); } + #[IsGranted('ROLE_INSTRUCTOR')] + #[Route('/byme', name: 'app_atelier_by_me', methods: ['GET'])] + public function index_created_by_user(AtelierRepository $atelierRepository, MarkdownAtelier $markdown): Response + { + $ateliers = $atelierRepository->findBy(['instructeur' => $this->getUser()]); + return $this->render('atelier/index.html.twig', [ + 'ateliers' => $markdown->parseArray($ateliers), + ]); + } + #[IsGranted('ROLE_INSTRUCTOR')] #[Route('/new', name: 'app_atelier_new', methods: ['GET', 'POST'])] public function new(Request $request, AtelierRepository $atelierRepository): Response From 37c1e24e1a0e83b767710c87e85d3558cb18aa0f Mon Sep 17 00:00:00 2001 From: Aymeric SERRA Date: Thu, 9 Feb 2023 09:14:35 +0100 Subject: [PATCH 3/4] Ajout d'un bouton Mes Ateliers dans la navbar --- templates/components/navbar.html.twig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/templates/components/navbar.html.twig b/templates/components/navbar.html.twig index d157ffb..b703a71 100644 --- a/templates/components/navbar.html.twig +++ b/templates/components/navbar.html.twig @@ -13,6 +13,11 @@ + {% if app.user %} + + {% endif %}
{% if app.user %} From c0357d6947a05725571b370bb86a9e626c2fa556 Mon Sep 17 00:00:00 2001 From: Aymeric SERRA Date: Thu, 9 Feb 2023 09:23:54 +0100 Subject: [PATCH 4/4] Modification mise en page liste ateliers quand il n'y a pas encore d'ateliers --- templates/atelier/index.html.twig | 81 ++++++++++++++++--------------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/templates/atelier/index.html.twig b/templates/atelier/index.html.twig index 6915971..c164b6c 100644 --- a/templates/atelier/index.html.twig +++ b/templates/atelier/index.html.twig @@ -3,46 +3,51 @@ {% block title %}Atelier index{% endblock %} {% block body %} -

Atelier index

+

Liste des Ateliers

- - - - - - - - - - - {% for atelier in ateliers %} + {% if (ateliers | length) > 0 %} +
IdNomDescriptionActions
+ - - - - + + + + + + + {% for atelier in ateliers %} + + + + + - - {% else %} - - - - {% endfor %} - -
{{ atelier.id }}{{ atelier.nom }}{{ atelier.description | raw }} -
- Afficher - {% if app.user and app.user == atelier.instructeur %} +
IdNomDescriptionActions
{{ atelier.id }}{{ atelier.nom }}{{ atelier.description | raw }} +
Modifier - {% else %} - - {% endif %} -
-
no records found
+ href="{{ path('app_atelier_show', {'id': atelier.id}) }}">Afficher + {% if app.user and app.user == atelier.instructeur %} + Modifier + {% else %} + + {% endif %} + + + + {% endfor %} + + - + + {% else %} + + {% endif %} {% endblock %}