From f79ee1e7b6f1446058236ac58fb5e8d150a224a9 Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 9 Dec 2025 17:14:35 +0100 Subject: [PATCH] refonte arborescence + correction des chemins --- blog/articles/list_article/liste_articles.js | 7 -- .../modifier_article/modifier_article.js | 68 ------------------- .../ajouter_article.html | 34 +++++++--- .../ajouter_categorie.html | 2 +- .../list_article => html}/liste_article.html | 36 ++++++---- .../liste_categorie.html | 4 +- .../modifier_article.html | 43 +++++------- .../modifier_categorie.html | 1 + .../ajouter_article => js}/ajouter_article.js | 11 ++- .../ajouter_categorie.js | 12 ++-- blog/js/liste_articles.js | 14 ++++ .../liste_categorie => js}/liste_categorie.js | 2 +- blog/js/modifier_article.js | 60 ++++++++++++++++ .../modifier_categorie.js | 2 +- .../mot_de_passe_oublie.html | 12 +++- .../page_de_connexion.html | 9 +-- .../reinitialisation_mot_de_passe.html | 6 +- .../page_de_connexion.js | 0 .../reinitialisation_du_mot_de_passe.js | 6 ++ .../ajouter_avant_apres.html | 0 .../ajouter_prestation.html | 0 .../ajouter_slider.html | 0 .../liste_avant_apres.html | 0 .../liste_prestation.html | 0 .../liste_slider => html}/liste_slider.html | 0 .../modifier_avant_apres.html | 0 .../modifier_prestation.html | 0 .../modifier_slider.html | 0 .../prestation_accueil.html | 0 .../voir_avant_apres.html | 0 .../ajouter_avant_apres.js | 0 .../ajouter_prestation.js | 0 .../ajouter_slider => js}/ajouter_slider.js | 0 .../liste_avant_apres.js | 0 .../liste_prestation.js | 0 .../liste_slider => js}/liste_slider.js | 0 .../modifier_avant_apres.js | 0 .../modifier_prestation.js | 0 .../modifier_slider => js}/modifier_slider.js | 0 .../voir_avant_apres.js | 0 40 files changed, 185 insertions(+), 144 deletions(-) delete mode 100644 blog/articles/list_article/liste_articles.js delete mode 100644 blog/articles/modifier_article/modifier_article.js rename blog/{articles/ajouter_article => html}/ajouter_article.html (82%) rename blog/{categories/ajouter_categorie => html}/ajouter_categorie.html (97%) rename blog/{articles/list_article => html}/liste_article.html (57%) rename blog/{categories/liste_categorie => html}/liste_categorie.html (91%) rename blog/{articles/modifier_article => html}/modifier_article.html (85%) rename blog/{categories/modifier_categorie => html}/modifier_categorie.html (97%) rename blog/{articles/ajouter_article => js}/ajouter_article.js (82%) rename blog/{categories/ajouter_categorie => js}/ajouter_categorie.js (80%) create mode 100644 blog/js/liste_articles.js rename blog/{categories/liste_categorie => js}/liste_categorie.js (92%) create mode 100644 blog/js/modifier_article.js rename blog/{categories/modifier_categorie => js}/modifier_categorie.js (88%) rename connexion/{mot_de_passe_oublie => html}/mot_de_passe_oublie.html (83%) rename connexion/{page_de_connexion => html}/page_de_connexion.html (83%) rename connexion/{reinitialisation_mot_de_passe => html}/reinitialisation_mot_de_passe.html (92%) rename connexion/{page_de_connexion => js}/page_de_connexion.js (100%) rename connexion/{reinitialisation_mot_de_passe => js}/reinitialisation_du_mot_de_passe.js (91%) rename prestations/{avant_apres/ajouter_avant_apres => html}/ajouter_avant_apres.html (100%) rename prestations/{ajouter_prestation => html}/ajouter_prestation.html (100%) rename prestations/{slider/ajouter_slider => html}/ajouter_slider.html (100%) rename prestations/{avant_apres/liste_avant_apres => html}/liste_avant_apres.html (100%) rename prestations/{liste_prestation => html}/liste_prestation.html (100%) rename prestations/{slider/liste_slider => html}/liste_slider.html (100%) rename prestations/{avant_apres/modifier_avant_apres => html}/modifier_avant_apres.html (100%) rename prestations/{modifier_prestation => html}/modifier_prestation.html (100%) rename prestations/{slider/modifier_slider => html}/modifier_slider.html (100%) rename prestations/{prestation_accueil => html}/prestation_accueil.html (100%) rename prestations/{avant_apres/voir_avant_apres => html}/voir_avant_apres.html (100%) rename prestations/{avant_apres/ajouter_avant_apres => js}/ajouter_avant_apres.js (100%) rename prestations/{ajouter_prestation => js}/ajouter_prestation.js (100%) rename prestations/{slider/ajouter_slider => js}/ajouter_slider.js (100%) rename prestations/{avant_apres/liste_avant_apres => js}/liste_avant_apres.js (100%) rename prestations/{liste_prestation => js}/liste_prestation.js (100%) rename prestations/{slider/liste_slider => js}/liste_slider.js (100%) rename prestations/{avant_apres/modifier_avant_apres => js}/modifier_avant_apres.js (100%) rename prestations/{modifier_prestation => js}/modifier_prestation.js (100%) rename prestations/{slider/modifier_slider => js}/modifier_slider.js (100%) rename prestations/{avant_apres/voir_avant_apres => js}/voir_avant_apres.js (100%) diff --git a/blog/articles/list_article/liste_articles.js b/blog/articles/list_article/liste_articles.js deleted file mode 100644 index 8dabe5e..0000000 --- a/blog/articles/list_article/liste_articles.js +++ /dev/null @@ -1,7 +0,0 @@ -function confirmerSuppression(titre) { - const confirmation = confirm(`Êtes-vous sûr de vouloir supprimer l'article "${titre}" ?`); - if (confirmation) { - alert(`L'article "${titre}" a été supprimé.`); - // Ici tu peux rediriger ou supprimer réellement - } -} diff --git a/blog/articles/modifier_article/modifier_article.js b/blog/articles/modifier_article/modifier_article.js deleted file mode 100644 index 1dd1c7e..0000000 --- a/blog/articles/modifier_article/modifier_article.js +++ /dev/null @@ -1,68 +0,0 @@ -const form = document.getElementById('editArticleForm'); -const imgField = document.getElementById('articleImage'); -const titleField = document.getElementById('articleTitle'); -const contentField = document.getElementById('articleContent'); -const categoryField = document.getElementById('articleCategory'); -const publishedField = document.getElementById('articlePublished'); - -const errorEmpty = document.getElementById('errorEmpty'); -const errorImage = document.getElementById('errorImage'); -const errorExists = document.getElementById('errorExists'); -const successMsg = document.getElementById('successMsg'); - -// Simulation BDD pour vérifier doublons -const titresExistants = [ - "article de test", - "nouveautés chiens", - "actualité du mois" -]; - -form.addEventListener('submit', function(e) { - e.preventDefault(); - - const titre = titleField.value.trim().toLowerCase(); - const fichierImage = imgField.files[0]; - - // Reset messages - errorEmpty.classList.add('d-none'); - errorImage.classList.add('d-none'); - errorExists.classList.add('d-none'); - successMsg.classList.add('d-none'); - - //Titre obligatoire - if (titre === "") { - errorEmpty.classList.remove('d-none'); - return; - } - - // Titre déjà existant ? - if (titresExistants.includes(titre)) { - errorExists.classList.remove('d-none'); - return; - } - - //Vérification image - if (fichierImage) { - const validFormats = ['image/jpeg', 'image/png', 'image/gif']; - if (!validFormats.includes(fichierImage.type)) { - errorImage.classList.remove('d-none'); - return; - } - } - - // Succès - successMsg.classList.remove('d-none'); - - console.log("Article modifié :", { - titre, - contenu: contentField.value, - categorie: categoryField.value, - publie: publishedField.checked, - image: fichierImage ? fichierImage.name : "Image inchangée" - }); - - - - -}); - diff --git a/blog/articles/ajouter_article/ajouter_article.html b/blog/html/ajouter_article.html similarity index 82% rename from blog/articles/ajouter_article/ajouter_article.html rename to blog/html/ajouter_article.html index 18e7bf3..75594e1 100644 --- a/blog/articles/ajouter_article/ajouter_article.html +++ b/blog/html/ajouter_article.html @@ -6,6 +6,9 @@ Ajouter un article + + + @@ -17,6 +20,9 @@ max-width: 700px; margin: 40px auto; } + .ck-editor__editable { + min-height: 350px; +} @@ -78,27 +84,39 @@
- +
- Annuler + Annuler
- + diff --git a/blog/categories/ajouter_categorie/ajouter_categorie.html b/blog/html/ajouter_categorie.html similarity index 97% rename from blog/categories/ajouter_categorie/ajouter_categorie.html rename to blog/html/ajouter_categorie.html index ca71275..b288956 100644 --- a/blog/categories/ajouter_categorie/ajouter_categorie.html +++ b/blog/html/ajouter_categorie.html @@ -50,7 +50,7 @@ - + diff --git a/blog/articles/list_article/liste_article.html b/blog/html/liste_article.html similarity index 57% rename from blog/articles/list_article/liste_article.html rename to blog/html/liste_article.html index d45d144..f48d43b 100644 --- a/blog/articles/list_article/liste_article.html +++ b/blog/html/liste_article.html @@ -33,22 +33,32 @@ - - - Mon premier article - Chien - Oui - - Voir - Modifier - - - - + + Mon premier article + Chien + Oui + + Voir + Modifier + + + + + + Mon deuxième article + Chat + Oui + + Voir + Modifier + + + + - + diff --git a/blog/categories/liste_categorie/liste_categorie.html b/blog/html/liste_categorie.html similarity index 91% rename from blog/categories/liste_categorie/liste_categorie.html rename to blog/html/liste_categorie.html index 402532f..85ed338 100644 --- a/blog/categories/liste_categorie/liste_categorie.html +++ b/blog/html/liste_categorie.html @@ -28,7 +28,7 @@
- + Ajouter une catégorie
@@ -48,7 +48,7 @@ - + diff --git a/blog/articles/modifier_article/modifier_article.html b/blog/html/modifier_article.html similarity index 85% rename from blog/articles/modifier_article/modifier_article.html rename to blog/html/modifier_article.html index b4ebdf5..92305c2 100644 --- a/blog/articles/modifier_article/modifier_article.html +++ b/blog/html/modifier_article.html @@ -6,6 +6,7 @@ Modifier un article + @@ -99,7 +103,7 @@
- Annuler + Annuler
@@ -109,37 +113,22 @@ - + - - - - - - - - - - - - - - - - - - - - diff --git a/blog/categories/modifier_categorie/modifier_categorie.html b/blog/html/modifier_categorie.html similarity index 97% rename from blog/categories/modifier_categorie/modifier_categorie.html rename to blog/html/modifier_categorie.html index d27d7d9..bcb8eaa 100644 --- a/blog/categories/modifier_categorie/modifier_categorie.html +++ b/blog/html/modifier_categorie.html @@ -49,6 +49,7 @@ + diff --git a/blog/articles/ajouter_article/ajouter_article.js b/blog/js/ajouter_article.js similarity index 82% rename from blog/articles/ajouter_article/ajouter_article.js rename to blog/js/ajouter_article.js index 8941a8d..181b008 100644 --- a/blog/articles/ajouter_article/ajouter_article.js +++ b/blog/js/ajouter_article.js @@ -1,4 +1,4 @@ -const form = document.getElementById('addArticleForm'); +const form = document.getElementById('ajouterArticleForm'); const imgField = document.getElementById('articleImage'); const titleField = document.getElementById('articleTitle'); const contentField = document.getElementById('articleContent'); @@ -16,7 +16,7 @@ const titreExistants = ['décoration noel', 'coupe de chien']; form.addEventListener('submit', function(e) { e.preventDefault(); - const titre = titleField.value.trim() .toLowerCase(); + const titre = titleField.value.trim().toLowerCase(); const fichierImage = imgField.files[0]; // Reset messages @@ -49,4 +49,11 @@ form.addEventListener('submit', function(e) { // Simuler enregistrement titreExistants.push(titre); + // Succès + successMsg.classList.remove('d-none'); + + // Redirection après 1 seconde + setTimeout(() => { + window.location.href = "../html/liste_article.html"; + }, 1000); }); diff --git a/blog/categories/ajouter_categorie/ajouter_categorie.js b/blog/js/ajouter_categorie.js similarity index 80% rename from blog/categories/ajouter_categorie/ajouter_categorie.js rename to blog/js/ajouter_categorie.js index 3eedbf4..c904fdc 100644 --- a/blog/categories/ajouter_categorie/ajouter_categorie.js +++ b/blog/js/ajouter_categorie.js @@ -32,12 +32,16 @@ form.addEventListener("submit", function (e) { return; } - //Succès - successMessage.classList.remove("d-none"); + // Succès +successMessage.classList.remove("d-none"); +// Ajout d'une nouvelle catégorie +existingCategories.push(nom); - //Ajout d'une nouvelle catégorie en BDD - existingCategories.push(nom); +// Redirection après 1 seconde +setTimeout(() => { + window.location.href = "../html/liste_categorie.html"; +}, 1000); }); \ No newline at end of file diff --git a/blog/js/liste_articles.js b/blog/js/liste_articles.js new file mode 100644 index 0000000..f562797 --- /dev/null +++ b/blog/js/liste_articles.js @@ -0,0 +1,14 @@ + +document.addEventListener("click", function (e) { + const btn = e.target.closest(".delete-btn"); + if (!btn) return; // on a cliqué ailleurs + + // On récupère la ligne de l'article + const row = btn.closest("tr"); + const titre = row.querySelector("td").textContent.trim(); + + if (confirm(`Voulez-vous vraiment supprimer l'article : "${titre}" ?`)) { + row.remove(); // supprime la ligne + alert("Article supprimé !"); + } +}); \ No newline at end of file diff --git a/blog/categories/liste_categorie/liste_categorie.js b/blog/js/liste_categorie.js similarity index 92% rename from blog/categories/liste_categorie/liste_categorie.js rename to blog/js/liste_categorie.js index 3a4d2f8..4f8ef98 100644 --- a/blog/categories/liste_categorie/liste_categorie.js +++ b/blog/js/liste_categorie.js @@ -20,7 +20,7 @@ function afficherCategories() { ${cat.description || "-"} - + Modifier diff --git a/blog/js/modifier_article.js b/blog/js/modifier_article.js new file mode 100644 index 0000000..e87ce17 --- /dev/null +++ b/blog/js/modifier_article.js @@ -0,0 +1,60 @@ +const form = document.getElementById("editArticleForm"); +const imgField = document.getElementById("articleImage"); +const titleField = document.getElementById("articleTitle"); +const contentField = document.getElementById("articleContent"); +const categoryField = document.getElementById("articleCategory"); +const publishedField = document.getElementById("articlePublished"); + +const errorEmpty = document.getElementById("errorEmpty"); +const errorImage = document.getElementById("errorImage"); +const errorExists = document.getElementById("errorExists"); +const successMsg = document.getElementById("successMsg"); + +// Simulation BDD pour vérifier doublons +const titresExistants = [ + "article de test", + "nouveautés chiens", + "actualité du mois", +]; + +form.addEventListener("submit", function (e) { + e.preventDefault(); + + const titre = titleField.value.trim().toLowerCase(); + const fichierImage = imgField.files[0]; + + // Reset messages + errorEmpty.classList.add("d-none"); + errorImage.classList.add("d-none"); + errorExists.classList.add("d-none"); + successMsg.classList.add("d-none"); + + //Titre obligatoire + if (titre === "") { + errorEmpty.classList.remove("d-none"); + return; + } + + // Titre déjà existant ? + if (titresExistants.includes(titre)) { + errorExists.classList.remove("d-none"); + return; + } + + //Vérification image + if (fichierImage) { + const validFormats = ["image/jpeg", "image/png", "image/gif"]; + if (!validFormats.includes(fichierImage.type)) { + errorImage.classList.remove("d-none"); + return; + } + } + + // Succès + successMsg.classList.remove("d-none"); + + // Redirection après succès + setTimeout(() => { + window.location.href = "../html/liste_article.html"; + }, 1500); +}); diff --git a/blog/categories/modifier_categorie/modifier_categorie.js b/blog/js/modifier_categorie.js similarity index 88% rename from blog/categories/modifier_categorie/modifier_categorie.js rename to blog/js/modifier_categorie.js index cd6df7b..7642c4d 100644 --- a/blog/categories/modifier_categorie/modifier_categorie.js +++ b/blog/js/modifier_categorie.js @@ -21,6 +21,6 @@ form.addEventListener("submit", function (e) { // Redirection après succès setTimeout(() => { - window.location.href = "../../../blog/categories/liste_categorie/liste_categorie.html"; + window.location.href = "../html/liste_categorie.html"; }, 1500); }); diff --git a/connexion/mot_de_passe_oublie/mot_de_passe_oublie.html b/connexion/html/mot_de_passe_oublie.html similarity index 83% rename from connexion/mot_de_passe_oublie/mot_de_passe_oublie.html rename to connexion/html/mot_de_passe_oublie.html index 7375a1b..d17c54f 100644 --- a/connexion/mot_de_passe_oublie/mot_de_passe_oublie.html +++ b/connexion/html/mot_de_passe_oublie.html @@ -11,7 +11,7 @@