From 0f497d215de8e16739263e2718bd39640a6cc4d8 Mon Sep 17 00:00:00 2001 From: polo Date: Thu, 8 May 2025 22:58:04 +0200 Subject: modif page, renommage et suppression, du responsive design, modif dans Director, notif toast --- public/js/main.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'public/js') diff --git a/public/js/main.js b/public/js/main.js index e278325..802bbbe 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -202,4 +202,33 @@ function findParent(element, tag_name){ element = element.parentElement; } return null; +} + + +/* -- mode Modification d'une page -- */ +function renamePageBloc(bloc_id){ + const input = document.getElementById("bloc_rename_" + bloc_id); + const title = document.getElementById(bloc_id).querySelector("h3"); + + fetch('index.php?bloc_edit=rename_page_bloc', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({bloc_title: input.value, bloc_id: bloc_id}) + }) + .then(response => response.json()) + .then(data => { + if(data.success){ + title.innerHTML = data.title; + console.log(data.title); + toastNotify('Le bloc a été renommé: ' + data.title); + } + else{ + console.error('Erreur au renommage du titre.'); + } + }) + .catch(error => { + console.error('Erreur:', error); + }); } \ No newline at end of file -- cgit v1.2.3