From c5d9df5c42b5d2522e2a06b5f40422c1bbf497ab Mon Sep 17 00:00:00 2001 From: polo Date: Sat, 6 Sep 2025 00:33:22 +0200 Subject: =?UTF-8?q?correction=20bug=20au=20nombre=20de=20colonne=20lors=20?= =?UTF-8?q?du=20changement=20de=20la=20pr=C3=A9sentation=20d'un=20bloc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/modif_page.js | 1 + src/view/NewsBlockBuilder.php | 5 +++-- src/view/PostBlockBuilder.php | 5 +++-- src/view/templates/modify_block.php | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/public/js/modif_page.js b/public/js/modif_page.js index dd7271e..ee2004b 100644 --- a/public/js/modif_page.js +++ b/public/js/modif_page.js @@ -188,6 +188,7 @@ function changePresentation(bloc_id){ .then(data => { if(data.success){ document.getElementById(bloc_id).className = presentation; + document.getElementById(bloc_id).querySelector(".section_child").style.gridTemplateColumns = presentation === 'grid' ? 'repeat(auto-fit, minmax(' + data.cols_min_width + 'px, 1fr))' : ''; document.getElementById('cols_min_width_edit_' + bloc_id).className = presentation === 'grid' ? '' : 'hidden'; console.log('changement de présentation'); } diff --git a/src/view/NewsBlockBuilder.php b/src/view/NewsBlockBuilder.php index 4716c63..76e42c5 100644 --- a/src/view/NewsBlockBuilder.php +++ b/src/view/NewsBlockBuilder.php @@ -23,9 +23,10 @@ class NewsBlockBuilder extends AbstractBuilder // stratégie d'affichage du contenu (utilisation de méthodes ou de classe List, GridPresentation, etc) $section_class = $node->getNodeData()->getPresentation()->getName(); // = list, grid , mosaic ou carousel + $cols_min_width = ''; if($section_class === 'grid'){ - $min_width = (string)$node->getNodeData()->getColsMinWidth(); - $cols_min_width = 'grid-template-columns: repeat(auto-fit, minmax(' . $min_width . 'px, 1fr));'; + $min_width = $node->getNodeData()->getColsMinWidth(); + $cols_min_width = 'grid-template-columns: repeat(auto-fit, minmax(' . (string)$min_width . 'px, 1fr));'; } // ajouter un article diff --git a/src/view/PostBlockBuilder.php b/src/view/PostBlockBuilder.php index 017e78e..dca4fbd 100644 --- a/src/view/PostBlockBuilder.php +++ b/src/view/PostBlockBuilder.php @@ -23,9 +23,10 @@ class PostBlockBuilder extends AbstractBuilder // stratégie d'affichage du contenu (utilisation de méthodes ou de classe List, GridPresentation, etc) $section_class = $node->getNodeData()->getPresentation()->getName(); // = list, grid , mosaic ou carousel + $cols_min_width = ''; if($section_class === 'grid'){ - $min_width = (string)$node->getNodeData()->getColsMinWidth(); - $cols_min_width = 'grid-template-columns: repeat(auto-fit, minmax(' . $min_width . 'px, 1fr));'; + $min_width = $node->getNodeData()->getColsMinWidth(); + $cols_min_width = 'grid-template-columns: repeat(auto-fit, minmax(' . (string)$min_width . 'px, 1fr));'; } // ajouter un article diff --git a/src/view/templates/modify_block.php b/src/view/templates/modify_block.php index dae8994..2514085 100644 --- a/src/view/templates/modify_block.php +++ b/src/view/templates/modify_block.php @@ -27,7 +27,7 @@ if($child_node->getNodeData()->getPresentation() !== null){ makePresentationOptions($child_node->getNodeData()->getPresentation()->getName()) ?>
- + pixels
-- cgit v1.2.3