From 725fa47c6ddce48a1366e6a24db6f6dbb27366b6 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 2 Jan 2022 01:01:00 +0100 Subject: [PATCH] Start on the fridge frontend Create list overview without styling Start on editer of fridge --- src/Controller/FridgeController.php | 34 +++++++++++++++++++++++++++++ src/Form/FridgeType.php | 29 ++++++++++++++++++++++++ templates/base/navbar.html.twig | 11 ++++++++-- templates/fridge/list.html.twig | 8 +++++++ templates/fridge/single.html.twig | 5 +++++ 5 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 src/Controller/FridgeController.php create mode 100644 src/Form/FridgeType.php create mode 100644 templates/fridge/list.html.twig create mode 100644 templates/fridge/single.html.twig diff --git a/src/Controller/FridgeController.php b/src/Controller/FridgeController.php new file mode 100644 index 0000000..cc00a7f --- /dev/null +++ b/src/Controller/FridgeController.php @@ -0,0 +1,34 @@ +findAll(); + + return $this->render('fridge/list.html.twig', [ + 'fridges' => $fridges, + ]); + } + + #[Route('/single/{fridge}', name: '_single')] + public function single(Fridge $fridge, Request $request) + { + $form = $this->createForm(FridgeType::class, $fridge); + + return $this->render('fridge/single.html.twig', [ + 'form' => $form->createView(), + ]); + } +} \ No newline at end of file diff --git a/src/Form/FridgeType.php b/src/Form/FridgeType.php new file mode 100644 index 0000000..c3fee99 --- /dev/null +++ b/src/Form/FridgeType.php @@ -0,0 +1,29 @@ +add('name') + ->add('description') + ->add('productLines') + ->add('save', SubmitType::class) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Fridge::class, + ]); + } +} diff --git a/templates/base/navbar.html.twig b/templates/base/navbar.html.twig index fbf3dc1..f4f9662 100644 --- a/templates/base/navbar.html.twig +++ b/templates/base/navbar.html.twig @@ -2,7 +2,8 @@
IceCold -