From a2121389bb13c59af63eae1049aaadf02409681f Mon Sep 17 00:00:00 2001 From: nox Date: Sat, 23 Nov 2019 16:50:18 +0100 Subject: [PATCH] Mise en place de la carte de France interactive --- src/Gmarche/Actions/RegionIndexAction.php | 21 +--- src/Gmarche/GmarcheModule.php | 2 +- src/Gmarche/views/index.twig | 118 +++++++++++++++++++--- views/layout.twig | 8 +- 4 files changed, 116 insertions(+), 33 deletions(-) diff --git a/src/Gmarche/Actions/RegionIndexAction.php b/src/Gmarche/Actions/RegionIndexAction.php index 9b81ebd..37ac75d 100644 --- a/src/Gmarche/Actions/RegionIndexAction.php +++ b/src/Gmarche/Actions/RegionIndexAction.php @@ -1,44 +1,31 @@ renderer = $renderer; - $this->regionTable = $regionTable; + $this->renderer = $renderer; } - - public function __invoke(Request $request) + public function __invoke() { - $params = $request->getQueryParams(); - $regions = $this->regionTable->findAll()->paginate(15, $params['p'] ?? 1); session_start(); if (isset($_SESSION['user'])) { $nom_user = $_SESSION['user']; } else { $nom_user = ''; } - return $this->renderer->render('@gmarche/index', compact('nom_user','regions')); + return $this->renderer->render('@gmarche/index', compact('nom_user')); } } diff --git a/src/Gmarche/GmarcheModule.php b/src/Gmarche/GmarcheModule.php index 3adde69..fd4df78 100644 --- a/src/Gmarche/GmarcheModule.php +++ b/src/Gmarche/GmarcheModule.php @@ -21,6 +21,6 @@ class GmarcheModule extends Module $container->get(RendererInterface::class)->addPath('gmarche', __DIR__ . '/views'); $router = $container->get(Router::class); $router->get("$gmarchePrefix", RegionIndexAction::class, 'gmarche.index'); - $router->get("$gmarchePrefix{slug:[a-z\-0-9]+}", AntenneShowAction::class, 'gmarche.antenne'); + $router->get("$gmarchePrefix{france}/{slug:[a-z\-0-9]+}", AntenneShowAction::class, 'gmarche.antenne'); } } diff --git a/src/Gmarche/views/index.twig b/src/Gmarche/views/index.twig index 7da33c4..02a7235 100644 --- a/src/Gmarche/views/index.twig +++ b/src/Gmarche/views/index.twig @@ -4,19 +4,113 @@ Ğ1-Marché : Régions {% if page > 1 %}, page {{ page }} {% endif %} {% endblock %} {% block body %} -
- -
+
+ +
- -{% endblock %} + + + +{% endblock %} \ No newline at end of file diff --git a/views/layout.twig b/views/layout.twig index f712ea6..deda089 100644 --- a/views/layout.twig +++ b/views/layout.twig @@ -7,6 +7,7 @@ + - - + + + +
@@ -50,7 +53,6 @@ - {% if nom_user != '' %}