summaryrefslogtreecommitdiff
path: root/public/js/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js/main.js')
-rw-r--r--public/js/main.js29
1 files changed, 29 insertions, 0 deletions
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){
202 element = element.parentElement; 202 element = element.parentElement;
203 } 203 }
204 return null; 204 return null;
205}
206
207
208/* -- mode Modification d'une page -- */
209function renamePageBloc(bloc_id){
210 const input = document.getElementById("bloc_rename_" + bloc_id);
211 const title = document.getElementById(bloc_id).querySelector("h3");
212
213 fetch('index.php?bloc_edit=rename_page_bloc', {
214 method: 'POST',
215 headers: {
216 'Content-Type': 'application/json'
217 },
218 body: JSON.stringify({bloc_title: input.value, bloc_id: bloc_id})
219 })
220 .then(response => response.json())
221 .then(data => {
222 if(data.success){
223 title.innerHTML = data.title;
224 console.log(data.title);
225 toastNotify('Le bloc a été renommé: ' + data.title);
226 }
227 else{
228 console.error('Erreur au renommage du titre.');
229 }
230 })
231 .catch(error => {
232 console.error('Erreur:', error);
233 });
205} \ No newline at end of file 234} \ No newline at end of file