aboutsummaryrefslogtreecommitdiff
path: root/public/js/modif_page.js
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2025-09-29 15:39:49 +0200
committerpolo <ordipolo@gmx.fr>2025-09-29 15:39:49 +0200
commit58d2a7f5f0b8fbb93730ad2332fa484bbfc80d4c (patch)
tree8376c00ae1a46076609b7a3fe743730b2e14ff5e /public/js/modif_page.js
parente93cd6c352a8e4fbb4e1174bdb15484adbe4c0f7 (diff)
downloadcms-58d2a7f5f0b8fbb93730ad2332fa484bbfc80d4c.zip
ordre des news inversables, champ chrono_order dans NodeData
Diffstat (limited to 'public/js/modif_page.js')
-rw-r--r--public/js/modif_page.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/public/js/modif_page.js b/public/js/modif_page.js
index ee2004b..bf269ee 100644
--- a/public/js/modif_page.js
+++ b/public/js/modif_page.js
@@ -176,6 +176,35 @@ function switchBlocsPositions(bloc_id, direction) {
176 }); 176 });
177} 177}
178 178
179function articlesOrderSelect(bloc_id){
180 const articles_order_select = document.getElementById('articles_order_select_' + bloc_id).value;
181
182 fetch('index.php?bloc_edit=change_articles_order', {
183 method: 'POST',
184 headers: { 'Content-Type': 'application/json' },
185 body: JSON.stringify({ id: bloc_id, chrono_order: articles_order_select })
186 })
187 .then(response => response.json())
188 .then(data => {
189 if(data.success){
190 // inverser l'ordre des articles!!
191 const parent = document.getElementById(bloc_id).querySelector(".section_child");
192 const articles = Array.from(parent.querySelectorAll("article"));
193 articles.reverse().forEach(article => {
194 parent.appendChild(article); // déplace dans le DOM, ne copie pas
195 });
196
197 console.log('ordre ' + articles_order_select);
198 }
199 else{
200 console.log("Erreur au changement de l'ordre d'affichage côté serveur");
201 }
202 })
203 .catch(error => {
204 console.error('Erreur:', error);
205 });
206}
207
179function changePresentation(bloc_id){ 208function changePresentation(bloc_id){
180 const presentation = document.getElementById('presentation_select_' + bloc_id).value; 209 const presentation = document.getElementById('presentation_select_' + bloc_id).value;
181 210