From 75f2c543e7fe45c1a3dcea842650a5d13a0235f0 Mon Sep 17 00:00:00 2001 From: polo Date: Sun, 13 Apr 2025 13:30:31 +0200 Subject: =?UTF-8?q?menu=20et=20fil=20d'ariane=20g=C3=A8rent=20le=20champ?= =?UTF-8?q?=20reachable=20dans=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/nav.css | 15 ++++++++------ src/model/Menu.php | 6 +++--- src/model/entities/Page.php | 7 +++++-- src/view/BreadcrumbBuilder.php | 17 ++++++---------- src/view/NavBuilder.php | 44 ++++++++++++++++++++++++------------------ 5 files changed, 48 insertions(+), 41 deletions(-) diff --git a/public/css/nav.css b/public/css/nav.css index d51c58a..bff3896 100644 --- a/public/css/nav.css +++ b/public/css/nav.css @@ -48,14 +48,17 @@ ul background-color: white; font-weight: bold; } -.drop-down > p::after +.drop-down > a > p::after { content: ' ▼'; font-size: x-small; } -.drop-down:hover > .sub-menu /* faire apparaître sub-menu */ -{ +/* faire apparaître sub-menu */ +.drop-down:hover > .sub-menu{ + display: block; +} +.drop-right:hover > .sub-menu{ display: block; } .sub-menu @@ -71,7 +74,7 @@ ul { background-color: #ffff00; } -.drop-down .sub-menu .drop-down > p:after /* bricolage? */ +.drop-right > a > p:after { content: " ▶"; font-size: x-small; @@ -83,11 +86,11 @@ nav > ul > li > ul position: absolute; /* retire du flux, positionnement par rapport à la fenêtre */ } /* élément du menu survolé, le positionnement relatif en fait la référence du positionnement suivant */ -.drop-down .sub-menu .drop-down +.drop-right { position: relative; } -.drop-down .sub-menu .drop-down .sub-menu +.drop-right .sub-menu { position: absolute; /* positionnement par rapport au précédent "position" en CSS */ left: 100%; diff --git a/src/model/Menu.php b/src/model/Menu.php index 624a0fc..403accf 100644 --- a/src/model/Menu.php +++ b/src/model/Menu.php @@ -20,12 +20,12 @@ class Menu extends Page ->getResult(); // :array de Page if(count($bulk_data) === 0){ - makeStartPage($entityManager); + makeStartPage($entityManager); // => installation.php } foreach($bulk_data as $first_level_entries){ - // génération du menu - if($first_level_entries->getInMenu()){ + // dans le menu + if($first_level_entries->isInMenu()){ $this->addChild($first_level_entries); } // autres pages diff --git a/src/model/entities/Page.php b/src/model/entities/Page.php index fbf0f27..c40a297 100644 --- a/src/model/entities/Page.php +++ b/src/model/entities/Page.php @@ -73,7 +73,11 @@ class Page { return $this->end_of_path; } - public function getInMenu(): bool + public function isReachable(): bool + { + return $this->reachable; + } + public function isInMenu(): bool { return $this->in_menu; } @@ -112,7 +116,6 @@ class Page { for($i = 0; $i < $iteration - 1; $i++) { - //echo '
' . $this->children[$i]->getPosition() . ' - ' . $this->children[$i + 1]->getPosition(); if($this->children[$i]->getPosition() > $this->children[$i + 1]->getPosition()) { $tmp = $this->children[$i]; diff --git a/src/view/BreadcrumbBuilder.php b/src/view/BreadcrumbBuilder.php index f1fdddf..77f4c4c 100644 --- a/src/view/BreadcrumbBuilder.php +++ b/src/view/BreadcrumbBuilder.php @@ -7,10 +7,10 @@ class BreadcrumbBuilder extends AbstractBuilder { public function __construct(Node $node) { - $this->html = $this->breadcrumbHTML(false); + $this->html = $this->breadcrumbHTML(); } - private function breadcrumbHTML(bool $links = false): string + private function breadcrumbHTML(): string { $asset = 'assets/home.svg'; // => BDD? $breadcrumb_array = Director::$page_path->getArray(); // tableau de Page @@ -23,21 +23,16 @@ class BreadcrumbBuilder extends AbstractBuilder $html .= '