From 6ae15fa0df5f9243b0a06ce81d2243e49bf75510 Mon Sep 17 00:00:00 2001
From: Eric WAGNER <eric.wagner@etu.unistra.fr>
Date: Thu, 30 Mar 2023 10:33:45 +0200
Subject: [PATCH] modification de liens du header

---
 src/Controller/StaticPages.php      |  7 +++++++
 templates/home.html.twig            | 22 ----------------------
 templates/layouts/_header.html.twig |  9 ++++-----
 3 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/src/Controller/StaticPages.php b/src/Controller/StaticPages.php
index c3576ab..c4078d1 100644
--- a/src/Controller/StaticPages.php
+++ b/src/Controller/StaticPages.php
@@ -7,6 +7,10 @@ use App\Entity\Ecurie;
 use App\Form\EcurieType;
 use App\Repository\EcurieRepository;
 
+use App\Entity\Category;
+use App\Form\CategoryType;
+use App\Repository\CategoryRepository;
+
 
 use Symfony\Component\HttpFoundation\Response;
 use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -21,11 +25,14 @@ class StaticPages extends AbstractController
     {
         $ecurieRepository = $this->getDoctrine()
                                  ->getRepository(Ecurie::class);   
+        $categoryRepository = $this->getDoctrine()
+                                 ->getRepository(Category::class);   
         $titre = 'Bienvenue';
  
         return $this->render('home.html.twig', [
             'titre' => $titre,
             'ecuries' => $ecurieRepository->findAll(),
+            'categories' => $categoryRepository->findAll(),
         ]);
     }
 }
\ No newline at end of file
diff --git a/templates/home.html.twig b/templates/home.html.twig
index b26d645..fe3ba82 100644
--- a/templates/home.html.twig
+++ b/templates/home.html.twig
@@ -36,26 +36,4 @@
             </a>
         </div>
     </div>
-
-    <h1 class="text-3xl px-[5rem]">Shop By Driver</h1>
-    <div class="flex flex-row mt-[1.5rem]">
-        <a href="">
-            <img src="{{ asset('img/drivers/max_verstappen.avif') }}" alt="">
-        </a>
-        <a href="">
-            <img src="{{ asset('img/drivers/charles_leclerc.avif') }}" alt="">
-        </a>
-        <a href="">
-            <img src="{{ asset('img/drivers/lewis_hamilton.avif') }}" alt="">
-        </a>
-        <a href="">
-            <img src="{{ asset('img/drivers/fernando_alonso.avif') }}" alt="">
-        </a>
-        <a href="">
-            <img src="{{ asset('img/drivers/sergio_perez.avif') }}" alt="">
-        </a>
-        <a href="">
-            <img src="{{ asset('img/drivers/carlos_sainz.avif') }}" alt="">
-        </a>
-    </div>
 {% endblock %}
\ No newline at end of file
diff --git a/templates/layouts/_header.html.twig b/templates/layouts/_header.html.twig
index 0958464..548b099 100644
--- a/templates/layouts/_header.html.twig
+++ b/templates/layouts/_header.html.twig
@@ -22,13 +22,12 @@
 <nav>
     <ul class="flex flex-row justify-around uppercase">
         <li class="hover:bg-[#EEEEEE] px-[1rem] font-medium w-full text-center">
-            <a href="" class="leading-[2.1875rem] ">équipes</a>
+            <a href="{{ path('app_ecurie_index') }}" class="leading-[2.1875rem] ">équipes</a>
         </li>
+        {% for category in categories %}
         <li class="hover:bg-[#EEEEEE] px-[1rem] font-medium w-full text-center">
-            <a href="" class="leading-[2.1875rem] ">pilotes</a>
-        </li>
-        <li class="hover:bg-[#EEEEEE] px-[1rem] font-medium w-full text-center">
-            <a href="" class="leading-[2.1875rem] ">casquettes et chapeaux</a>
+            <a href="{{ path('app_category_show', {'id': category.id}) }}" class="leading-[2.1875rem] ">{{ category.name }}</a>
         </li>
+        {% endfor %}
     </ul>
 </nav>
\ No newline at end of file
-- 
GitLab