From dfc5aed25070c827d7c59b55fa991d174060dc35 Mon Sep 17 00:00:00 2001 From: Eric WAGNER <eric.wagner@etu.unistra.fr> Date: Thu, 30 Mar 2023 09:05:32 +0200 Subject: [PATCH] ajout des fichiers controleurs --- src/Controller/CategoryController.php | 78 +++++++++++++++++++++++ src/Controller/ClothesController.php | 78 +++++++++++++++++++++++ src/Controller/EcurieController.php | 78 +++++++++++++++++++++++ src/Form/CategoryType.php | 25 ++++++++ src/Form/ClothesType.php | 29 +++++++++ src/Form/EcurieType.php | 26 ++++++++ templates/category/_delete_form.html.twig | 4 ++ templates/category/_form.html.twig | 4 ++ templates/category/edit.html.twig | 13 ++++ templates/category/index.html.twig | 35 ++++++++++ templates/category/new.html.twig | 11 ++++ templates/category/show.html.twig | 26 ++++++++ templates/clothes/_delete_form.html.twig | 4 ++ templates/clothes/_form.html.twig | 4 ++ templates/clothes/edit.html.twig | 13 ++++ templates/clothes/index.html.twig | 39 ++++++++++++ templates/clothes/new.html.twig | 11 ++++ templates/clothes/show.html.twig | 34 ++++++++++ templates/ecurie/_delete_form.html.twig | 4 ++ templates/ecurie/_form.html.twig | 4 ++ templates/ecurie/edit.html.twig | 13 ++++ templates/ecurie/index.html.twig | 37 +++++++++++ templates/ecurie/new.html.twig | 11 ++++ templates/ecurie/show.html.twig | 30 +++++++++ templates/home.html.twig | 2 +- 25 files changed, 612 insertions(+), 1 deletion(-) create mode 100644 src/Controller/CategoryController.php create mode 100644 src/Controller/ClothesController.php create mode 100644 src/Controller/EcurieController.php create mode 100644 src/Form/CategoryType.php create mode 100644 src/Form/ClothesType.php create mode 100644 src/Form/EcurieType.php create mode 100644 templates/category/_delete_form.html.twig create mode 100644 templates/category/_form.html.twig create mode 100644 templates/category/edit.html.twig create mode 100644 templates/category/index.html.twig create mode 100644 templates/category/new.html.twig create mode 100644 templates/category/show.html.twig create mode 100644 templates/clothes/_delete_form.html.twig create mode 100644 templates/clothes/_form.html.twig create mode 100644 templates/clothes/edit.html.twig create mode 100644 templates/clothes/index.html.twig create mode 100644 templates/clothes/new.html.twig create mode 100644 templates/clothes/show.html.twig create mode 100644 templates/ecurie/_delete_form.html.twig create mode 100644 templates/ecurie/_form.html.twig create mode 100644 templates/ecurie/edit.html.twig create mode 100644 templates/ecurie/index.html.twig create mode 100644 templates/ecurie/new.html.twig create mode 100644 templates/ecurie/show.html.twig diff --git a/src/Controller/CategoryController.php b/src/Controller/CategoryController.php new file mode 100644 index 0000000..4bcf50d --- /dev/null +++ b/src/Controller/CategoryController.php @@ -0,0 +1,78 @@ +<?php + +namespace App\Controller; + +use App\Entity\Category; +use App\Form\CategoryType; +use App\Repository\CategoryRepository; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Annotation\Route; + +#[Route('/category')] +class CategoryController extends AbstractController +{ + #[Route('/', name: 'app_category_index', methods: ['GET'])] + public function index(CategoryRepository $categoryRepository): Response + { + return $this->render('category/index.html.twig', [ + 'categories' => $categoryRepository->findAll(), + ]); + } + + #[Route('/new', name: 'app_category_new', methods: ['GET', 'POST'])] + public function new(Request $request, CategoryRepository $categoryRepository): Response + { + $category = new Category(); + $form = $this->createForm(CategoryType::class, $category); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $categoryRepository->save($category, true); + + return $this->redirectToRoute('app_category_index', [], Response::HTTP_SEE_OTHER); + } + + return $this->renderForm('category/new.html.twig', [ + 'category' => $category, + 'form' => $form, + ]); + } + + #[Route('/{id}', name: 'app_category_show', methods: ['GET'])] + public function show(Category $category): Response + { + return $this->render('category/show.html.twig', [ + 'category' => $category, + ]); + } + + #[Route('/{id}/edit', name: 'app_category_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, Category $category, CategoryRepository $categoryRepository): Response + { + $form = $this->createForm(CategoryType::class, $category); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $categoryRepository->save($category, true); + + return $this->redirectToRoute('app_category_index', [], Response::HTTP_SEE_OTHER); + } + + return $this->renderForm('category/edit.html.twig', [ + 'category' => $category, + 'form' => $form, + ]); + } + + #[Route('/{id}', name: 'app_category_delete', methods: ['POST'])] + public function delete(Request $request, Category $category, CategoryRepository $categoryRepository): Response + { + if ($this->isCsrfTokenValid('delete'.$category->getId(), $request->request->get('_token'))) { + $categoryRepository->remove($category, true); + } + + return $this->redirectToRoute('app_category_index', [], Response::HTTP_SEE_OTHER); + } +} diff --git a/src/Controller/ClothesController.php b/src/Controller/ClothesController.php new file mode 100644 index 0000000..a26bd16 --- /dev/null +++ b/src/Controller/ClothesController.php @@ -0,0 +1,78 @@ +<?php + +namespace App\Controller; + +use App\Entity\Clothes; +use App\Form\ClothesType; +use App\Repository\ClothesRepository; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Annotation\Route; + +#[Route('/clothes')] +class ClothesController extends AbstractController +{ + #[Route('/', name: 'app_clothes_index', methods: ['GET'])] + public function index(ClothesRepository $clothesRepository): Response + { + return $this->render('clothes/index.html.twig', [ + 'clothes' => $clothesRepository->findAll(), + ]); + } + + #[Route('/new', name: 'app_clothes_new', methods: ['GET', 'POST'])] + public function new(Request $request, ClothesRepository $clothesRepository): Response + { + $clothes = new Clothes(); + $form = $this->createForm(ClothesType::class, $clothes); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $clothesRepository->save($clothes, true); + + return $this->redirectToRoute('app_clothes_index', [], Response::HTTP_SEE_OTHER); + } + + return $this->renderForm('clothes/new.html.twig', [ + 'clothes' => $clothes, + 'form' => $form, + ]); + } + + #[Route('/{id}', name: 'app_clothes_show', methods: ['GET'])] + public function show(Clothes $clothes): Response + { + return $this->render('clothes/show.html.twig', [ + 'clothes' => $clothes, + ]); + } + + #[Route('/{id}/edit', name: 'app_clothes_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, Clothes $clothes, ClothesRepository $clothesRepository): Response + { + $form = $this->createForm(ClothesType::class, $clothes); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $clothesRepository->save($clothes, true); + + return $this->redirectToRoute('app_clothes_index', [], Response::HTTP_SEE_OTHER); + } + + return $this->renderForm('clothes/edit.html.twig', [ + 'clothes' => $clothes, + 'form' => $form, + ]); + } + + #[Route('/{id}', name: 'app_clothes_delete', methods: ['POST'])] + public function delete(Request $request, Clothes $clothes, ClothesRepository $clothesRepository): Response + { + if ($this->isCsrfTokenValid('delete'.$clothes->getId(), $request->request->get('_token'))) { + $clothesRepository->remove($clothes, true); + } + + return $this->redirectToRoute('app_clothes_index', [], Response::HTTP_SEE_OTHER); + } +} diff --git a/src/Controller/EcurieController.php b/src/Controller/EcurieController.php new file mode 100644 index 0000000..f53c3a7 --- /dev/null +++ b/src/Controller/EcurieController.php @@ -0,0 +1,78 @@ +<?php + +namespace App\Controller; + +use App\Entity\Ecurie; +use App\Form\EcurieType; +use App\Repository\EcurieRepository; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Annotation\Route; + +#[Route('/ecurie')] +class EcurieController extends AbstractController +{ + #[Route('/', name: 'app_ecurie_index', methods: ['GET'])] + public function index(EcurieRepository $ecurieRepository): Response + { + return $this->render('ecurie/index.html.twig', [ + 'ecuries' => $ecurieRepository->findAll(), + ]); + } + + #[Route('/new', name: 'app_ecurie_new', methods: ['GET', 'POST'])] + public function new(Request $request, EcurieRepository $ecurieRepository): Response + { + $ecurie = new Ecurie(); + $form = $this->createForm(EcurieType::class, $ecurie); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $ecurieRepository->save($ecurie, true); + + return $this->redirectToRoute('app_ecurie_index', [], Response::HTTP_SEE_OTHER); + } + + return $this->renderForm('ecurie/new.html.twig', [ + 'ecurie' => $ecurie, + 'form' => $form, + ]); + } + + #[Route('/{id}', name: 'app_ecurie_show', methods: ['GET'])] + public function show(Ecurie $ecurie): Response + { + return $this->render('ecurie/show.html.twig', [ + 'ecurie' => $ecurie, + ]); + } + + #[Route('/{id}/edit', name: 'app_ecurie_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, Ecurie $ecurie, EcurieRepository $ecurieRepository): Response + { + $form = $this->createForm(EcurieType::class, $ecurie); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $ecurieRepository->save($ecurie, true); + + return $this->redirectToRoute('app_ecurie_index', [], Response::HTTP_SEE_OTHER); + } + + return $this->renderForm('ecurie/edit.html.twig', [ + 'ecurie' => $ecurie, + 'form' => $form, + ]); + } + + #[Route('/{id}', name: 'app_ecurie_delete', methods: ['POST'])] + public function delete(Request $request, Ecurie $ecurie, EcurieRepository $ecurieRepository): Response + { + if ($this->isCsrfTokenValid('delete'.$ecurie->getId(), $request->request->get('_token'))) { + $ecurieRepository->remove($ecurie, true); + } + + return $this->redirectToRoute('app_ecurie_index', [], Response::HTTP_SEE_OTHER); + } +} diff --git a/src/Form/CategoryType.php b/src/Form/CategoryType.php new file mode 100644 index 0000000..8e4de0e --- /dev/null +++ b/src/Form/CategoryType.php @@ -0,0 +1,25 @@ +<?php + +namespace App\Form; + +use App\Entity\Category; +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class CategoryType extends AbstractType +{ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder + ->add('name') + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Category::class, + ]); + } +} diff --git a/src/Form/ClothesType.php b/src/Form/ClothesType.php new file mode 100644 index 0000000..f858b7e --- /dev/null +++ b/src/Form/ClothesType.php @@ -0,0 +1,29 @@ +<?php + +namespace App\Form; + +use App\Entity\Clothes; +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class ClothesType extends AbstractType +{ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder + ->add('name') + ->add('picture') + ->add('price') + ->add('category') + ->add('ecurie') + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Clothes::class, + ]); + } +} diff --git a/src/Form/EcurieType.php b/src/Form/EcurieType.php new file mode 100644 index 0000000..249b855 --- /dev/null +++ b/src/Form/EcurieType.php @@ -0,0 +1,26 @@ +<?php + +namespace App\Form; + +use App\Entity\Ecurie; +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class EcurieType extends AbstractType +{ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder + ->add('name') + ->add('picture') + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Ecurie::class, + ]); + } +} diff --git a/templates/category/_delete_form.html.twig b/templates/category/_delete_form.html.twig new file mode 100644 index 0000000..535a698 --- /dev/null +++ b/templates/category/_delete_form.html.twig @@ -0,0 +1,4 @@ +<form method="post" action="{{ path('app_category_delete', {'id': category.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');"> + <input type="hidden" name="_token" value="{{ csrf_token('delete' ~ category.id) }}"> + <button class="btn">Delete</button> +</form> diff --git a/templates/category/_form.html.twig b/templates/category/_form.html.twig new file mode 100644 index 0000000..bf20b98 --- /dev/null +++ b/templates/category/_form.html.twig @@ -0,0 +1,4 @@ +{{ form_start(form) }} + {{ form_widget(form) }} + <button class="btn">{{ button_label|default('Save') }}</button> +{{ form_end(form) }} diff --git a/templates/category/edit.html.twig b/templates/category/edit.html.twig new file mode 100644 index 0000000..2be3489 --- /dev/null +++ b/templates/category/edit.html.twig @@ -0,0 +1,13 @@ +{% extends 'base.html.twig' %} + +{% block title %}Edit Category{% endblock %} + +{% block body %} + <h1>Edit Category</h1> + + {{ include('category/_form.html.twig', {'button_label': 'Update'}) }} + + <a href="{{ path('app_category_index') }}">back to list</a> + + {{ include('category/_delete_form.html.twig') }} +{% endblock %} diff --git a/templates/category/index.html.twig b/templates/category/index.html.twig new file mode 100644 index 0000000..d361559 --- /dev/null +++ b/templates/category/index.html.twig @@ -0,0 +1,35 @@ +{% extends 'base.html.twig' %} + +{% block title %}Category index{% endblock %} + +{% block body %} + <h1>Category index</h1> + + <table class="table"> + <thead> + <tr> + <th>Id</th> + <th>Name</th> + <th>actions</th> + </tr> + </thead> + <tbody> + {% for category in categories %} + <tr> + <td>{{ category.id }}</td> + <td>{{ category.name }}</td> + <td> + <a href="{{ path('app_category_show', {'id': category.id}) }}">show</a> + <a href="{{ path('app_category_edit', {'id': category.id}) }}">edit</a> + </td> + </tr> + {% else %} + <tr> + <td colspan="3">no records found</td> + </tr> + {% endfor %} + </tbody> + </table> + + <a href="{{ path('app_category_new') }}">Create new</a> +{% endblock %} diff --git a/templates/category/new.html.twig b/templates/category/new.html.twig new file mode 100644 index 0000000..bab5f3c --- /dev/null +++ b/templates/category/new.html.twig @@ -0,0 +1,11 @@ +{% extends 'base.html.twig' %} + +{% block title %}New Category{% endblock %} + +{% block body %} + <h1>Create new Category</h1> + + {{ include('category/_form.html.twig') }} + + <a href="{{ path('app_category_index') }}">back to list</a> +{% endblock %} diff --git a/templates/category/show.html.twig b/templates/category/show.html.twig new file mode 100644 index 0000000..d86f086 --- /dev/null +++ b/templates/category/show.html.twig @@ -0,0 +1,26 @@ +{% extends 'base.html.twig' %} + +{% block title %}Category{% endblock %} + +{% block body %} + <h1>Category</h1> + + <table class="table"> + <tbody> + <tr> + <th>Id</th> + <td>{{ category.id }}</td> + </tr> + <tr> + <th>Name</th> + <td>{{ category.name }}</td> + </tr> + </tbody> + </table> + + <a href="{{ path('app_category_index') }}">back to list</a> + + <a href="{{ path('app_category_edit', {'id': category.id}) }}">edit</a> + + {{ include('category/_delete_form.html.twig') }} +{% endblock %} diff --git a/templates/clothes/_delete_form.html.twig b/templates/clothes/_delete_form.html.twig new file mode 100644 index 0000000..6f5eca9 --- /dev/null +++ b/templates/clothes/_delete_form.html.twig @@ -0,0 +1,4 @@ +<form method="post" action="{{ path('app_clothes_delete', {'id': clothes.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');"> + <input type="hidden" name="_token" value="{{ csrf_token('delete' ~ clothes.id) }}"> + <button class="btn">Delete</button> +</form> diff --git a/templates/clothes/_form.html.twig b/templates/clothes/_form.html.twig new file mode 100644 index 0000000..bf20b98 --- /dev/null +++ b/templates/clothes/_form.html.twig @@ -0,0 +1,4 @@ +{{ form_start(form) }} + {{ form_widget(form) }} + <button class="btn">{{ button_label|default('Save') }}</button> +{{ form_end(form) }} diff --git a/templates/clothes/edit.html.twig b/templates/clothes/edit.html.twig new file mode 100644 index 0000000..61b1b07 --- /dev/null +++ b/templates/clothes/edit.html.twig @@ -0,0 +1,13 @@ +{% extends 'base.html.twig' %} + +{% block title %}Edit Clothes{% endblock %} + +{% block body %} + <h1>Edit Clothes</h1> + + {{ include('clothes/_form.html.twig', {'button_label': 'Update'}) }} + + <a href="{{ path('app_clothes_index') }}">back to list</a> + + {{ include('clothes/_delete_form.html.twig') }} +{% endblock %} diff --git a/templates/clothes/index.html.twig b/templates/clothes/index.html.twig new file mode 100644 index 0000000..c618a11 --- /dev/null +++ b/templates/clothes/index.html.twig @@ -0,0 +1,39 @@ +{% extends 'base.html.twig' %} + +{% block title %}Clothes index{% endblock %} + +{% block body %} + <h1>Clothes index</h1> + + <table class="table"> + <thead> + <tr> + <th>Id</th> + <th>Name</th> + <th>Picture</th> + <th>Price</th> + <th>actions</th> + </tr> + </thead> + <tbody> + {% for clothes in clothes %} + <tr> + <td>{{ clothes.id }}</td> + <td>{{ clothes.name }}</td> + <td>{{ clothes.picture }}</td> + <td>{{ clothes.price }}</td> + <td> + <a href="{{ path('app_clothes_show', {'id': clothes.id}) }}">show</a> + <a href="{{ path('app_clothes_edit', {'id': clothes.id}) }}">edit</a> + </td> + </tr> + {% else %} + <tr> + <td colspan="5">no records found</td> + </tr> + {% endfor %} + </tbody> + </table> + + <a href="{{ path('app_clothes_new') }}">Create new</a> +{% endblock %} diff --git a/templates/clothes/new.html.twig b/templates/clothes/new.html.twig new file mode 100644 index 0000000..64c6b00 --- /dev/null +++ b/templates/clothes/new.html.twig @@ -0,0 +1,11 @@ +{% extends 'base.html.twig' %} + +{% block title %}New Clothes{% endblock %} + +{% block body %} + <h1>Create new Clothes</h1> + + {{ include('clothes/_form.html.twig') }} + + <a href="{{ path('app_clothes_index') }}">back to list</a> +{% endblock %} diff --git a/templates/clothes/show.html.twig b/templates/clothes/show.html.twig new file mode 100644 index 0000000..655b8f2 --- /dev/null +++ b/templates/clothes/show.html.twig @@ -0,0 +1,34 @@ +{% extends 'base.html.twig' %} + +{% block title %}Clothes{% endblock %} + +{% block body %} + <h1>Clothes</h1> + + <table class="table"> + <tbody> + <tr> + <th>Id</th> + <td>{{ clothes.id }}</td> + </tr> + <tr> + <th>Name</th> + <td>{{ clothes.name }}</td> + </tr> + <tr> + <th>Picture</th> + <td>{{ clothes.picture }}</td> + </tr> + <tr> + <th>Price</th> + <td>{{ clothes.price }}</td> + </tr> + </tbody> + </table> + + <a href="{{ path('app_clothes_index') }}">back to list</a> + + <a href="{{ path('app_clothes_edit', {'id': clothes.id}) }}">edit</a> + + {{ include('clothes/_delete_form.html.twig') }} +{% endblock %} diff --git a/templates/ecurie/_delete_form.html.twig b/templates/ecurie/_delete_form.html.twig new file mode 100644 index 0000000..64a9403 --- /dev/null +++ b/templates/ecurie/_delete_form.html.twig @@ -0,0 +1,4 @@ +<form method="post" action="{{ path('app_ecurie_delete', {'id': ecurie.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');"> + <input type="hidden" name="_token" value="{{ csrf_token('delete' ~ ecurie.id) }}"> + <button class="btn">Delete</button> +</form> diff --git a/templates/ecurie/_form.html.twig b/templates/ecurie/_form.html.twig new file mode 100644 index 0000000..bf20b98 --- /dev/null +++ b/templates/ecurie/_form.html.twig @@ -0,0 +1,4 @@ +{{ form_start(form) }} + {{ form_widget(form) }} + <button class="btn">{{ button_label|default('Save') }}</button> +{{ form_end(form) }} diff --git a/templates/ecurie/edit.html.twig b/templates/ecurie/edit.html.twig new file mode 100644 index 0000000..bef5178 --- /dev/null +++ b/templates/ecurie/edit.html.twig @@ -0,0 +1,13 @@ +{% extends 'base.html.twig' %} + +{% block title %}Edit Ecurie{% endblock %} + +{% block body %} + <h1>Edit Ecurie</h1> + + {{ include('ecurie/_form.html.twig', {'button_label': 'Update'}) }} + + <a href="{{ path('app_ecurie_index') }}">back to list</a> + + {{ include('ecurie/_delete_form.html.twig') }} +{% endblock %} diff --git a/templates/ecurie/index.html.twig b/templates/ecurie/index.html.twig new file mode 100644 index 0000000..695b4ea --- /dev/null +++ b/templates/ecurie/index.html.twig @@ -0,0 +1,37 @@ +{% extends 'base.html.twig' %} + +{% block title %}Ecurie index{% endblock %} + +{% block body %} + <h1>Ecurie index</h1> + + <table class="table"> + <thead> + <tr> + <th>Id</th> + <th>Name</th> + <th>Picture</th> + <th>actions</th> + </tr> + </thead> + <tbody> + {% for ecurie in ecuries %} + <tr> + <td>{{ ecurie.id }}</td> + <td>{{ ecurie.name }}</td> + <td>{{ ecurie.picture }}</td> + <td> + <a href="{{ path('app_ecurie_show', {'id': ecurie.id}) }}">show</a> + <a href="{{ path('app_ecurie_edit', {'id': ecurie.id}) }}">edit</a> + </td> + </tr> + {% else %} + <tr> + <td colspan="4">no records found</td> + </tr> + {% endfor %} + </tbody> + </table> + + <a href="{{ path('app_ecurie_new') }}">Create new</a> +{% endblock %} diff --git a/templates/ecurie/new.html.twig b/templates/ecurie/new.html.twig new file mode 100644 index 0000000..c7aa8e2 --- /dev/null +++ b/templates/ecurie/new.html.twig @@ -0,0 +1,11 @@ +{% extends 'base.html.twig' %} + +{% block title %}New Ecurie{% endblock %} + +{% block body %} + <h1>Create new Ecurie</h1> + + {{ include('ecurie/_form.html.twig') }} + + <a href="{{ path('app_ecurie_index') }}">back to list</a> +{% endblock %} diff --git a/templates/ecurie/show.html.twig b/templates/ecurie/show.html.twig new file mode 100644 index 0000000..779341e --- /dev/null +++ b/templates/ecurie/show.html.twig @@ -0,0 +1,30 @@ +{% extends 'base.html.twig' %} + +{% block title %}Ecurie{% endblock %} + +{% block body %} + <h1>Ecurie</h1> + + <table class="table"> + <tbody> + <tr> + <th>Id</th> + <td>{{ ecurie.id }}</td> + </tr> + <tr> + <th>Name</th> + <td>{{ ecurie.name }}</td> + </tr> + <tr> + <th>Picture</th> + <td>{{ ecurie.picture }}</td> + </tr> + </tbody> + </table> + + <a href="{{ path('app_ecurie_index') }}">back to list</a> + + <a href="{{ path('app_ecurie_edit', {'id': ecurie.id}) }}">edit</a> + + {{ include('ecurie/_delete_form.html.twig') }} +{% endblock %} diff --git a/templates/home.html.twig b/templates/home.html.twig index 5a10033..b26d645 100644 --- a/templates/home.html.twig +++ b/templates/home.html.twig @@ -10,7 +10,7 @@ {% for ecurie in ecuries %} <li class="flex items-center"> <a href="{{ path('app_ecurie_show', {'id': ecurie.id}) }}"> - <img src="{{ ecurie.picture }}" class="w-[50px] m-[15px]" alt=""> + <img src="img/logo_equipes/{{ ecurie.picture }}" class="w-[50px] m-[15px]" alt=""> </a> </li> {% endfor %} -- GitLab