From c9aff025aa7e01badaad8467af6165b400cdaac4 Mon Sep 17 00:00:00 2001 From: polo Date: Wed, 22 Oct 2025 15:28:02 +0200 Subject: =?UTF-8?q?possibilit=C3=A9=20d'=C3=A9diter=20le=20texte=20dans=20?= =?UTF-8?q?header=20et=20footer,=20class=20JS=20InputText,=20Model::findWh?= =?UTF-8?q?ateverNode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/close-nb.svg | 1 + public/assets/close.svg | 37 ++++++++++++++++++++++++++++++++++++ public/css/body.css | 4 ++-- public/css/calendar.css | 1 - public/css/foot.css | 14 ++++++-------- public/css/head.css | 12 ++++++++++-- public/js/InputText.js | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 103 insertions(+), 13 deletions(-) create mode 100644 public/assets/close-nb.svg create mode 100644 public/assets/close.svg create mode 100644 public/js/InputText.js (limited to 'public') diff --git a/public/assets/close-nb.svg b/public/assets/close-nb.svg new file mode 100644 index 0000000..c5a6b6b --- /dev/null +++ b/public/assets/close-nb.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/assets/close.svg b/public/assets/close.svg new file mode 100644 index 0000000..4dfee8c --- /dev/null +++ b/public/assets/close.svg @@ -0,0 +1,37 @@ + + + + + + diff --git a/public/css/body.css b/public/css/body.css index 95f30d4..8ad3a52 100644 --- a/public/css/body.css +++ b/public/css/body.css @@ -188,7 +188,7 @@ button .action_icon:hover { margin-right: 2px; } -section button, section input[type=submit] +button, section input[type=submit] { color: #ff1d04; font-size: medium; @@ -196,7 +196,7 @@ section button, section input[type=submit] background-color: white; border: lightgrey 2px outset; /* rend identiques les boutons firefox et chromium */ } -section button:hover, section input[type=submit]:hover +button:hover, section input[type=submit]:hover { background-color: yellow; border-radius: 4px; diff --git a/public/css/calendar.css b/public/css/calendar.css index 2ff5640..d011f03 100644 --- a/public/css/calendar.css +++ b/public/css/calendar.css @@ -10,7 +10,6 @@ #calendar_zone{ display: flex; gap: 5px; - /*padding: 15px;*/ max-width: 1170px; } #calendar{ diff --git a/public/css/foot.css b/public/css/foot.css index ad86305..8d0a94d 100644 --- a/public/css/foot.css +++ b/public/css/foot.css @@ -11,11 +11,15 @@ footer } footer > div { - margin: auto; max-width: 1200px; display: flex; justify-content: space-around; } + +.contact +{ + margin: 16px 0; /* alignement avec la

autour du logo */ +} .contact a { color: unset; @@ -69,11 +73,6 @@ footer > div margin: 0 3px; }*/ -.contact -{ - padding: 0 15px; -} - .footer_logo img { max-width: 288px; @@ -115,8 +114,7 @@ footer > div } .logged_out { - /*display: none;*/ - justify-content: start; + justify-content: start; /* écrase le space-around dans footer > div */ } .logged_out a { diff --git a/public/css/head.css b/public/css/head.css index be938bb..b173077 100644 --- a/public/css/head.css +++ b/public/css/head.css @@ -24,6 +24,8 @@ header grid-template-columns: 1fr 1fr 1fr; align-items: end; } +/*.header_left_col +{}*/ @media screen and (max-width: 1000px){ .header-content{ padding: 18px 0; @@ -36,7 +38,7 @@ header display: block; padding: 18px; } - .head_logo + #header_logo { display: none; } @@ -74,12 +76,18 @@ header a color: unset; /* ne plus hériter */ text-decoration: none; } +#edit_favicon_zone +{ + margin-bottom: 10px; +} +/*.header_right_col +{}*/ .social { /*align-self: end;*/ /*padding: 4px;*/ } -.social img +.social a img { width: 25px; background-color: #ffffffb3; diff --git a/public/js/InputText.js b/public/js/InputText.js new file mode 100644 index 0000000..ba7e8e4 --- /dev/null +++ b/public/js/InputText.js @@ -0,0 +1,47 @@ +// s'en servir dans menu et chemin +class InputText{ + constructor(name){ + this.name = name; + this.parent = document.getElementById(name); + } + openTextInput(){ + this.parent.querySelector('#' + this.name + '_span').classList.add('hidden'); + this.parent.querySelector('#' + this.name + '_input').classList.remove('hidden'); + this.parent.querySelector('#' + this.name + '_open').classList.add('hidden'); + this.parent.querySelector('#' + this.name + '_submit').classList.remove('hidden'); + this.parent.querySelector('#' + this.name + '_cancel').classList.remove('hidden'); + } + closeTextInput(){ + this.parent.querySelector('#' + this.name + '_span').classList.remove('hidden'); + this.parent.querySelector('#' + this.name + '_input').classList.add('hidden'); + this.parent.querySelector('#' + this.name + '_open').classList.remove('hidden'); + this.parent.querySelector('#' + this.name + '_submit').classList.add('hidden'); + this.parent.querySelector('#' + this.name + '_cancel').classList.add('hidden'); + } + submitTextInput(){ + const new_text = this.parent.querySelector('#' + this.name + '_input').value; + + fetch('index.php?entire_site_edit=' + this.name, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({new_text: new_text}) + }) + .then(response => response.json()) + .then(data => { + if(data.success){ + this.parent.querySelector('#' + this.name + '_span').innerHTML = new_text; + this.closeTextInput(this.name); + } + else{ + console.error("Erreur: le serveur n'a pas enregistré le nouveau texte."); + } + }) + .catch(error => { + console.error('Erreur:', error); + }); + } + cancelTextInput(){ + this.parent.querySelector('#' + this.name + '_input').value = this.parent.querySelector('#' + this.name + '_span').innerHTML; + this.closeTextInput(this.name); + } +} \ No newline at end of file -- cgit v1.2.3