diff options
author | polo <ordipolo@gmx.fr> | 2025-07-18 15:57:57 +0200 |
---|---|---|
committer | polo <ordipolo@gmx.fr> | 2025-07-18 15:57:57 +0200 |
commit | b55a029a5b4867349a172873d20a6ffd91c20e23 (patch) | |
tree | 724b89251f8efbedbe6e06411546fab01e948d53 | |
parent | 27d88f0b226a0bb8e07f0bea83f47a9bc4bbff32 (diff) | |
download | cms-b55a029a5b4867349a172873d20a6ffd91c20e23.zip |
petites améliorations smartphones, logo et fond de header et footer gérés dans NodeData
-rw-r--r-- | public/css/body.css | 6 | ||||
-rw-r--r-- | public/css/head.css | 33 | ||||
-rw-r--r-- | public/css/nav.css | 60 | ||||
-rw-r--r-- | public/js/main.js | 65 | ||||
-rw-r--r-- | src/controller/installation.php | 12 | ||||
-rw-r--r-- | src/view/HeaderBuilder.php | 14 | ||||
-rw-r--r-- | src/view/templates/footer.php | 2 | ||||
-rw-r--r-- | src/view/templates/header.php | 7 |
8 files changed, 152 insertions, 47 deletions
diff --git a/public/css/body.css b/public/css/body.css index c3f518a..a03510f 100644 --- a/public/css/body.css +++ b/public/css/body.css | |||
@@ -67,8 +67,12 @@ section > h3 | |||
67 | grid-template-columns: repeat(2, 1fr); | 67 | grid-template-columns: repeat(2, 1fr); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | @media screen and (max-width: 550px) | 70 | @media screen and (max-width: 600px) |
71 | { | 71 | { |
72 | article | ||
73 | { | ||
74 | /*margin: 5px;*/ | ||
75 | } | ||
72 | .grid_columns | 76 | .grid_columns |
73 | { | 77 | { |
74 | display: block; | 78 | display: block; |
diff --git a/public/css/head.css b/public/css/head.css index a55449a..be938bb 100644 --- a/public/css/head.css +++ b/public/css/head.css | |||
@@ -3,7 +3,6 @@ header | |||
3 | text-align: center; | 3 | text-align: center; |
4 | /*padding-top: 5px;*/ | 4 | /*padding-top: 5px;*/ |
5 | /*padding-bottom: 10px;*/ | 5 | /*padding-bottom: 10px;*/ |
6 | background-image: url('../assets/fond-piscine.jpg'); | ||
7 | background-size: cover; /* largeur du bloc_page */ | 6 | background-size: cover; /* largeur du bloc_page */ |
8 | } | 7 | } |
9 | #nav_zone | 8 | #nav_zone |
@@ -14,14 +13,35 @@ header | |||
14 | /*align-items: center;*/ /* conflit possible avec .social align-self */ | 13 | /*align-items: center;*/ /* conflit possible avec .social align-self */ |
15 | justify-content: center; | 14 | justify-content: center; |
16 | } | 15 | } |
16 | .nav_button{ | ||
17 | display: none; | ||
18 | } | ||
17 | 19 | ||
18 | .header-content | 20 | .header-content |
19 | { | 21 | { |
20 | padding: 20px 0; | 22 | padding: 20px 0; |
21 | display: grid; | 23 | display: grid; |
22 | grid-template-columns: repeat(3, 1fr); | 24 | grid-template-columns: 1fr 1fr 1fr; |
23 | align-items: end; | 25 | align-items: end; |
24 | } | 26 | } |
27 | @media screen and (max-width: 1000px){ | ||
28 | .header-content{ | ||
29 | padding: 18px 0; | ||
30 | } | ||
31 | } | ||
32 | @media screen and (max-width: 450px){ | ||
33 | .header-content | ||
34 | { | ||
35 | /*grid-template-columns: 1fr 2fr 1fr;*/ | ||
36 | display: block; | ||
37 | padding: 18px; | ||
38 | } | ||
39 | .head_logo | ||
40 | { | ||
41 | display: none; | ||
42 | } | ||
43 | } | ||
44 | |||
25 | .site_title | 45 | .site_title |
26 | { | 46 | { |
27 | background-color: #ffffff7f; | 47 | background-color: #ffffff7f; |
@@ -37,6 +57,12 @@ header h2 | |||
37 | font-size: medium; /* défaut = x-large */ | 57 | font-size: medium; /* défaut = x-large */ |
38 | margin: 10px; | 58 | margin: 10px; |
39 | } | 59 | } |
60 | @media screen and (max-width: 1000px){ | ||
61 | header h1, header h2 | ||
62 | { | ||
63 | margin: 8px; | ||
64 | } | ||
65 | } | ||
40 | header img | 66 | header img |
41 | { | 67 | { |
42 | vertical-align: bottom; /* supprime espace sous l'image */ | 68 | vertical-align: bottom; /* supprime espace sous l'image */ |
@@ -50,7 +76,8 @@ header a | |||
50 | } | 76 | } |
51 | .social | 77 | .social |
52 | { | 78 | { |
53 | align-self: end; | 79 | /*align-self: end;*/ |
80 | /*padding: 4px;*/ | ||
54 | } | 81 | } |
55 | .social img | 82 | .social img |
56 | { | 83 | { |
diff --git a/public/css/nav.css b/public/css/nav.css index 3ccdb1f..17b30c9 100644 --- a/public/css/nav.css +++ b/public/css/nav.css | |||
@@ -1,7 +1,8 @@ | |||
1 | /*-- menu principal --*/ | 1 | /*-- menu principal --*/ |
2 | #nav_zone | 2 | #nav_zone |
3 | { | 3 | { |
4 | height: 33px; | 4 | /*height: 33px;*/ |
5 | /*width: 100%;*/ | ||
5 | } | 6 | } |
6 | .nav_main | 7 | .nav_main |
7 | { | 8 | { |
@@ -121,11 +122,13 @@ li:not(.current){ | |||
121 | nav > ul > li > ul | 122 | nav > ul > li > ul |
122 | { | 123 | { |
123 | position: absolute; /* retire du flux, positionnement par rapport à la fenêtre */ | 124 | position: absolute; /* retire du flux, positionnement par rapport à la fenêtre */ |
125 | margin-left: -7px; /* annuler le déplacement dû au padding: 7px; dans ".nav_main li" */ | ||
126 | margin-top: 7px; | ||
124 | } | 127 | } |
125 | /* élément du menu survolé, le positionnement relatif en fait la référence du positionnement suivant */ | 128 | /* élément du menu survolé, le positionnement relatif en fait la référence du positionnement suivant */ |
126 | .drop-right | 129 | .drop-right |
127 | { | 130 | { |
128 | position: relative; | 131 | /*position: relative;*/ |
129 | } | 132 | } |
130 | .drop-right .sub-menu | 133 | .drop-right .sub-menu |
131 | { | 134 | { |
@@ -133,3 +136,56 @@ nav > ul > li > ul | |||
133 | left: 100%; | 136 | left: 100%; |
134 | top: -3px; /* la bordure bleue fait 3px */ | 137 | top: -3px; /* la bordure bleue fait 3px */ |
135 | } | 138 | } |
139 | |||
140 | @media screen and (max-width: 1000px){ | ||
141 | #nav_zone | ||
142 | { | ||
143 | /*height: 29px;*/ | ||
144 | } | ||
145 | .nav_main li | ||
146 | { | ||
147 | padding: 5px; | ||
148 | } | ||
149 | .nav_main p | ||
150 | { | ||
151 | /*font-size: smaller;*/ | ||
152 | font-size: 90%; | ||
153 | } | ||
154 | nav > ul > li > ul | ||
155 | { | ||
156 | margin-left: -5px; | ||
157 | margin-top: 5px; | ||
158 | } | ||
159 | } | ||
160 | @media screen and (max-width: 450px){ | ||
161 | .nav_button | ||
162 | { | ||
163 | /*display: block;*/ | ||
164 | } | ||
165 | #nav_zone | ||
166 | { | ||
167 | /*position: fixed; | ||
168 | justify-content: left;*/ | ||
169 | } | ||
170 | .nav_main | ||
171 | { | ||
172 | /*top: 0px;*/ | ||
173 | } | ||
174 | .nav_main > ul | ||
175 | { | ||
176 | /*flex-direction: column;*/ | ||
177 | } | ||
178 | .nav_main li | ||
179 | { | ||
180 | /**/ | ||
181 | } | ||
182 | .sub-menu p | ||
183 | { | ||
184 | font-size: smaller; | ||
185 | } | ||
186 | .drop-down > .sub-menu | ||
187 | { | ||
188 | /*flex-direction: row;*/ | ||
189 | /*position: static;*/ | ||
190 | } | ||
191 | } \ No newline at end of file | ||
diff --git a/public/js/main.js b/public/js/main.js index 6eb0162..2ffd33b 100644 --- a/public/js/main.js +++ b/public/js/main.js | |||
@@ -8,33 +8,6 @@ function newPassword(page, id = ''){ | |||
8 | }, 0); | 8 | }, 0); |
9 | } | 9 | } |
10 | 10 | ||
11 | // ouvrir/fermer les sous-menus avec écran tactile | ||
12 | document.addEventListener('DOMContentLoaded', () => { // sinon on ne trouve pas les boutons | ||
13 | document.querySelectorAll('.sub-menu-toggle').forEach(button => { | ||
14 | button.addEventListener('click', e => { | ||
15 | e.preventDefault(); | ||
16 | const li = button.parentElement; // <li class="drop-down"> | ||
17 | |||
18 | // fermer les autres sous-menus de même niveau | ||
19 | // :scope pour pouvoir utiliser > pour restreindre aux frères directs | ||
20 | li.parentElement.querySelectorAll(':scope > .drop-down, :scope > .drop-right').forEach(sibling => { | ||
21 | if(sibling !== li){ | ||
22 | sibling.classList.remove('open'); // fermer sous-menus frères | ||
23 | sibling.querySelectorAll('.drop-right').forEach(desc => { | ||
24 | desc.classList.remove('open'); // fermer sous-menus neveux | ||
25 | }); | ||
26 | } | ||
27 | }); | ||
28 | |||
29 | if(!li.classList.toggle('open')){ // fermer sous-menu | ||
30 | li.querySelectorAll('.drop-right').forEach(desc => { | ||
31 | desc.classList.remove('open'); // fermer sous-menus enfants | ||
32 | }); | ||
33 | } | ||
34 | }); | ||
35 | }); | ||
36 | }); | ||
37 | |||
38 | function copyInClipBoard(link){ | 11 | function copyInClipBoard(link){ |
39 | // une balise <input> avec des attributs | 12 | // une balise <input> avec des attributs |
40 | var element = document.createElement("input"); | 13 | var element = document.createElement("input"); |
@@ -64,6 +37,44 @@ function toastNotify(message) { | |||
64 | } | 37 | } |
65 | 38 | ||
66 | 39 | ||
40 | document.addEventListener('DOMContentLoaded', () => { // pour pouvoir attraper les balises | ||
41 | // ouvrir/fermer les sous-menus avec écran tactile | ||
42 | document.querySelectorAll('.sub-menu-toggle').forEach(button => { | ||
43 | button.addEventListener('click', e => { | ||
44 | e.preventDefault(); | ||
45 | const li = button.parentElement; // <li class="drop-down"> | ||
46 | |||
47 | // fermer les autres sous-menus de même niveau | ||
48 | // :scope pour pouvoir utiliser > pour restreindre aux frères directs | ||
49 | li.parentElement.querySelectorAll(':scope > .drop-down, :scope > .drop-right').forEach(sibling => { | ||
50 | if(sibling !== li){ | ||
51 | sibling.classList.remove('open'); // fermer sous-menus frères | ||
52 | sibling.querySelectorAll('.drop-right').forEach(desc => { | ||
53 | desc.classList.remove('open'); // fermer sous-menus neveux | ||
54 | }); | ||
55 | } | ||
56 | }); | ||
57 | |||
58 | if(!li.classList.toggle('open')){ // fermer sous-menu | ||
59 | li.querySelectorAll('.drop-right').forEach(desc => { | ||
60 | desc.classList.remove('open'); // fermer sous-menus enfants | ||
61 | }); | ||
62 | } | ||
63 | }); | ||
64 | }); | ||
65 | |||
66 | // hauteur de <nav> en fonction de celle du menu en position fixe | ||
67 | const nav = document.querySelector('nav'); | ||
68 | const nav_zone = document.getElementById('nav_zone'); | ||
69 | const resize_observer = new ResizeObserver(entries => { | ||
70 | for(const entry of entries){ | ||
71 | nav_zone.style.height = entry.contentRect.height + 'px'; | ||
72 | } | ||
73 | }); | ||
74 | resize_observer.observe(nav); | ||
75 | }); | ||
76 | |||
77 | |||
67 | // complète les fonctions dans tinymce.js | 78 | // complète les fonctions dans tinymce.js |
68 | function switchPositions(article_id, direction) | 79 | function switchPositions(article_id, direction) |
69 | { | 80 | { |
diff --git a/src/controller/installation.php b/src/controller/installation.php index 5cfae45..acb87f1 100644 --- a/src/controller/installation.php +++ b/src/controller/installation.php | |||
@@ -115,22 +115,22 @@ function makeStartPage(EntityManager $entityManager){ | |||
115 | /* -- table image -- */ | 115 | /* -- table image -- */ |
116 | // paramètres: file_name, file_path, file_path_mini, mime_type, alt | 116 | // paramètres: file_name, file_path, file_path_mini, mime_type, alt |
117 | $favicon = new Image("favicon48x48.png", NULL, "assets/favicon48x48.png", "image/png", "favicon"); | 117 | $favicon = new Image("favicon48x48.png", NULL, "assets/favicon48x48.png", "image/png", "favicon"); |
118 | $logo = new Image("logo-nb-et-ffn.png", NULL, "assets/logo-nb-et-ffn.png", "image/png", "head_logo"); | ||
119 | $facebook = new Image("facebook.svg", NULL, "assets/facebook.svg", "image/svg+xml", "facebook"); | 118 | $facebook = new Image("facebook.svg", NULL, "assets/facebook.svg", "image/svg+xml", "facebook"); |
120 | $instagram = new Image("instagram.svg", NULL, "assets/instagram.svg", "image/svg+xml", "instagram"); | 119 | $instagram = new Image("instagram.svg", NULL, "assets/instagram.svg", "image/svg+xml", "instagram"); |
121 | $linkedin = new Image("linkedin.svg", NULL, "assets/linkedin.svg", "image/svg+xml", "linkedin"); | 120 | $linkedin = new Image("linkedin.svg", NULL, "assets/linkedin.svg", "image/svg+xml", "linkedin"); |
122 | $github = new Image("github.svg", NULL, "assets/github.svg", "image/svg+xml", "github"); | 121 | $github = new Image("github.svg", NULL, "assets/github.svg", "image/svg+xml", "github"); |
123 | $fond_piscine = new Image("fond-piscine.jpg", "assets/fond-piscine.jpg", NULL, "images/jpg", "fond-piscine"); | ||
124 | 122 | ||
125 | /* -- table node_data -- */ | 123 | /* -- table node_data -- */ |
126 | // paramètres: data, node, images | 124 | // paramètres: data, node, images |
127 | $head_accueil_data = new NodeData(["description" => "Club, École de natation et Perfectionnement"], $head_accueil, new ArrayCollection([$favicon])); | 125 | $head_accueil_data = new NodeData(["description" => "page d'accueil"], $head_accueil, new ArrayCollection([$favicon])); |
128 | $head_login_data = new NodeData(["description" => "Connexion"], $head_login, new ArrayCollection([$favicon])); | 126 | $head_login_data = new NodeData(["description" => "Connexion"], $head_login, new ArrayCollection([$favicon])); |
129 | $head_article_data = new NodeData(["description" => ""], $head_article, new ArrayCollection([$favicon])); | 127 | $head_article_data = new NodeData(["description" => ""], $head_article, new ArrayCollection([$favicon])); |
130 | $head_edit_menu_data = new NodeData(["description" => "Menu et chemins"], $head_edit_menu, new ArrayCollection([$favicon])); | 128 | $head_edit_menu_data = new NodeData(["description" => "Menu et chemins"], $head_edit_menu, new ArrayCollection([$favicon])); |
131 | $head_new_page_data = new NodeData(["description" => "Nouvelle page"], $head_new_page, new ArrayCollection([$favicon])); | 129 | $head_new_page_data = new NodeData(["description" => "Nouvelle page"], $head_new_page, new ArrayCollection([$favicon])); |
132 | $header_data = new NodeData(["title" => "Les Nageurs Bigoudens", "description" => "Club, École de natation et Perfectionnement", "social" => ["facebook_link" => "https://www.facebook.com/nageursbigoudens29120", "instagram_link" => "https://www.instagram.com/nageursbigoudens/"]], $header, new ArrayCollection([$logo, $facebook, $instagram, $linkedin, $github, $fond_piscine])); | 130 | $header_data = new NodeData(["title" => "Titre", "description" => "Sous-titre", "header_logo" => "assets/logo-nb-et-ffn.png", "header_background" => "assets/fond-piscine.jpg", |
133 | $footer_data = new NodeData(["adresse" => "17, rue Raymonde Folgoas Guillou, 29120 Pont-l’Abbé", "contact_nom" => "Les Nageurs Bigoudens", "e_mail" => "nb.secretariat@orange.fr", "logo_footer" => "assets/logo-nb-et-ffn.png"], $footer); | 131 | "social" => ["facebook" => "https://www.facebook.com", "instagram" => "https://www.instagram.com", "linkedin" => "https://www.linkedin.com"]], |
132 | $header, new ArrayCollection([$facebook, $instagram, $linkedin, $github])); | ||
133 | $footer_data = new NodeData(["contact_nom" => "Nom", "adresse" => "adresse", "e_mail" => "e-mail", "footer_logo" => "assets/logo-nb-et-ffn.png"], $footer); | ||
134 | 134 | ||
135 | /* -- table page -- */ | 135 | /* -- table page -- */ |
136 | $entityManager->persist($accueil); | 136 | $entityManager->persist($accueil); |
@@ -157,12 +157,10 @@ function makeStartPage(EntityManager $entityManager){ | |||
157 | 157 | ||
158 | /* -- table image -- */ | 158 | /* -- table image -- */ |
159 | $entityManager->persist($favicon); | 159 | $entityManager->persist($favicon); |
160 | $entityManager->persist($logo); | ||
161 | $entityManager->persist($facebook); | 160 | $entityManager->persist($facebook); |
162 | $entityManager->persist($instagram); | 161 | $entityManager->persist($instagram); |
163 | $entityManager->persist($linkedin); | 162 | $entityManager->persist($linkedin); |
164 | $entityManager->persist($github); | 163 | $entityManager->persist($github); |
165 | $entityManager->persist($fond_piscine); | ||
166 | 164 | ||
167 | /* -- table node_data -- */ | 165 | /* -- table node_data -- */ |
168 | $entityManager->persist($head_accueil_data); | 166 | $entityManager->persist($head_accueil_data); |
diff --git a/src/view/HeaderBuilder.php b/src/view/HeaderBuilder.php index b49b24c..87dc2f2 100644 --- a/src/view/HeaderBuilder.php +++ b/src/view/HeaderBuilder.php | |||
@@ -55,16 +55,22 @@ class HeaderBuilder extends AbstractBuilder | |||
55 | { | 55 | { |
56 | for($i = 0; $i < count($keys); $i++) | 56 | for($i = 0; $i < count($keys); $i++) |
57 | { | 57 | { |
58 | // réseaux sociaux | ||
58 | if(str_contains($image->getFileName(), $keys[$i])){ | 59 | if(str_contains($image->getFileName(), $keys[$i])){ |
59 | $social_networks .= '<a href="' . $social[$keys[$i]] . '" target="_blank" rel="noopener noreferrer"> | 60 | $social_networks .= '<a href="' . $social[$keys[$i]] . '" target="_blank" rel="noopener noreferrer"> |
60 | <img src="' . rtrim($image->getFilePathMini(), '/') . '" alt="' . $keys[$i] . '_alt"></a>'; | 61 | <img src="' . rtrim($image->getFilePathMini(), '/') . '" alt="' . $keys[$i] . '_alt"></a>'; |
61 | break; | 62 | break; |
62 | } | 63 | } |
63 | if(str_contains($image->getFileName(), 'logo')) | 64 | // logo en-tête |
64 | { | 65 | /*if(str_contains($image->getFileName(), 'header_logo')){ |
65 | $logo = rtrim($image->getFilePathMini(), '/'); | 66 | $header_logo = rtrim($image->getFilePathMini(), '/'); |
66 | break; | 67 | break; |
67 | } | 68 | }*/ |
69 | // image de fond | ||
70 | /*if(str_contains($image->getFileName(), 'header_background')){ | ||
71 | $header_background = rtrim($image->getFilePath(), '/'); | ||
72 | break; | ||
73 | }*/ | ||
68 | } | 74 | } |
69 | } | 75 | } |
70 | 76 | ||
diff --git a/src/view/templates/footer.php b/src/view/templates/footer.php index 8f6d465..1b63edf 100644 --- a/src/view/templates/footer.php +++ b/src/view/templates/footer.php | |||
@@ -5,7 +5,7 @@ | |||
5 | <p class="contact"><?= $contact_nom ?><br> | 5 | <p class="contact"><?= $contact_nom ?><br> |
6 | <?= $adresse ?><br> | 6 | <?= $adresse ?><br> |
7 | <a href="mailto:<?= $e_mail ?>"><?= $e_mail ?></a></p> | 7 | <a href="mailto:<?= $e_mail ?>"><?= $e_mail ?></a></p> |
8 | <p class="footer_logo"><img src="<?= $logo_footer ?>" alt="logo"><p> | 8 | <p class="footer_logo"><img src="<?= $footer_logo ?>" alt="logo"><p> |
9 | </div> | 9 | </div> |
10 | <div class="<?= $empty_admin_zone ?>"></div> | 10 | <div class="<?= $empty_admin_zone ?>"></div> |
11 | <div class="<?= $div_admin ?>"> | 11 | <div class="<?= $div_admin ?>"> |
diff --git a/src/view/templates/header.php b/src/view/templates/header.php index a749f45..b1215c5 100644 --- a/src/view/templates/header.php +++ b/src/view/templates/header.php | |||
@@ -1,14 +1,17 @@ | |||
1 | <?php declare(strict_types=1); ?> | 1 | <?php declare(strict_types=1); ?> |
2 | <body> | 2 | <body> |
3 | <div> | 3 | <div> |
4 | <header> | 4 | <header style="background-image: url('<?= $header_background ?>');"> |
5 | <div id="nav_zone"> | 5 | <div id="nav_zone"> |
6 | <?= $nav ?> | 6 | <?= $nav ?> |
7 | </div> | 7 | </div> |
8 | 8 | ||
9 | <div class="header-content"> | 9 | <div class="header-content"> |
10 | <div class="head_logo"> | 10 | <div class="head_logo"> |
11 | <a href="<?= new URL ?>"><img src="<?= $logo ?>" alt="logo_alt"></a> | 11 | <a href="<?= new URL ?>"><img src="<?= $header_logo ?>" alt="logo_alt"></a> |
12 | </div> | ||
13 | <div class="nav_button"> | ||
14 | <button>MENU</button> | ||
12 | </div> | 15 | </div> |
13 | <div class="site_title"> | 16 | <div class="site_title"> |
14 | <a href="<?= new URL ?>"><h1><?= $title ?></h1></a> | 17 | <a href="<?= new URL ?>"><h1><?= $title ?></h1></a> |