diff options
author | polo <ordipolo@gmx.fr> | 2025-09-06 00:33:22 +0200 |
---|---|---|
committer | polo <ordipolo@gmx.fr> | 2025-09-06 00:33:22 +0200 |
commit | c5d9df5c42b5d2522e2a06b5f40422c1bbf497ab (patch) | |
tree | ce07ebbbc6212f2185ee9ab8024168e934319865 | |
parent | 7be773469a719d4170dcb6418b85277540c08b3f (diff) | |
download | cms-c5d9df5c42b5d2522e2a06b5f40422c1bbf497ab.zip |
correction bug au nombre de colonne lors du changement de la présentation d'un bloc
-rw-r--r-- | public/js/modif_page.js | 1 | ||||
-rw-r--r-- | src/view/NewsBlockBuilder.php | 5 | ||||
-rw-r--r-- | src/view/PostBlockBuilder.php | 5 | ||||
-rw-r--r-- | 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){ | |||
188 | .then(data => { | 188 | .then(data => { |
189 | if(data.success){ | 189 | if(data.success){ |
190 | document.getElementById(bloc_id).className = presentation; | 190 | document.getElementById(bloc_id).className = presentation; |
191 | document.getElementById(bloc_id).querySelector(".section_child").style.gridTemplateColumns = presentation === 'grid' ? 'repeat(auto-fit, minmax(' + data.cols_min_width + 'px, 1fr))' : ''; | ||
191 | document.getElementById('cols_min_width_edit_' + bloc_id).className = presentation === 'grid' ? '' : 'hidden'; | 192 | document.getElementById('cols_min_width_edit_' + bloc_id).className = presentation === 'grid' ? '' : 'hidden'; |
192 | console.log('changement de présentation'); | 193 | console.log('changement de présentation'); |
193 | } | 194 | } |
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 | |||
23 | 23 | ||
24 | // stratégie d'affichage du contenu (utilisation de méthodes ou de classe List, GridPresentation, etc) | 24 | // stratégie d'affichage du contenu (utilisation de méthodes ou de classe List, GridPresentation, etc) |
25 | $section_class = $node->getNodeData()->getPresentation()->getName(); // = list, grid , mosaic ou carousel | 25 | $section_class = $node->getNodeData()->getPresentation()->getName(); // = list, grid , mosaic ou carousel |
26 | $cols_min_width = ''; | ||
26 | if($section_class === 'grid'){ | 27 | if($section_class === 'grid'){ |
27 | $min_width = (string)$node->getNodeData()->getColsMinWidth(); | 28 | $min_width = $node->getNodeData()->getColsMinWidth(); |
28 | $cols_min_width = 'grid-template-columns: repeat(auto-fit, minmax(' . $min_width . 'px, 1fr));'; | 29 | $cols_min_width = 'grid-template-columns: repeat(auto-fit, minmax(' . (string)$min_width . 'px, 1fr));'; |
29 | } | 30 | } |
30 | 31 | ||
31 | // ajouter un article | 32 | // 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 | |||
23 | 23 | ||
24 | // stratégie d'affichage du contenu (utilisation de méthodes ou de classe List, GridPresentation, etc) | 24 | // stratégie d'affichage du contenu (utilisation de méthodes ou de classe List, GridPresentation, etc) |
25 | $section_class = $node->getNodeData()->getPresentation()->getName(); // = list, grid , mosaic ou carousel | 25 | $section_class = $node->getNodeData()->getPresentation()->getName(); // = list, grid , mosaic ou carousel |
26 | $cols_min_width = ''; | ||
26 | if($section_class === 'grid'){ | 27 | if($section_class === 'grid'){ |
27 | $min_width = (string)$node->getNodeData()->getColsMinWidth(); | 28 | $min_width = $node->getNodeData()->getColsMinWidth(); |
28 | $cols_min_width = 'grid-template-columns: repeat(auto-fit, minmax(' . $min_width . 'px, 1fr));'; | 29 | $cols_min_width = 'grid-template-columns: repeat(auto-fit, minmax(' . (string)$min_width . 'px, 1fr));'; |
29 | } | 30 | } |
30 | 31 | ||
31 | // ajouter un article | 32 | // 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){ | |||
27 | <?= $this->makePresentationOptions($child_node->getNodeData()->getPresentation()->getName()) ?> | 27 | <?= $this->makePresentationOptions($child_node->getNodeData()->getPresentation()->getName()) ?> |
28 | </select> | 28 | </select> |
29 | <div id="cols_min_width_edit_<?= $child_node->getId() ?>" class="<?= ($child_node->getNodeData()->getPresentation()->getName() === 'grid' ? '' : 'hidden') ?>"> | 29 | <div id="cols_min_width_edit_<?= $child_node->getId() ?>" class="<?= ($child_node->getNodeData()->getPresentation()->getName() === 'grid' ? '' : 'hidden') ?>"> |
30 | <label for="cols_min_width_select_' . $child_node->getId() . '">Largeur minimum </label> | 30 | <label for="cols_min_width_select_<?= $child_node->getId() ?>">Largeur minimum </label> |
31 | <input type="number" id="cols_min_width_select_<?= $child_node->getId() ?>" onchange="changeColsMinWidth(<?= $child_node->getId() ?>)" min="150" max="400" value="<?= $child_node->getNodeData()->getColsMinWidth() ?>"> pixels | 31 | <input type="number" id="cols_min_width_select_<?= $child_node->getId() ?>" onchange="changeColsMinWidth(<?= $child_node->getId() ?>)" min="150" max="400" value="<?= $child_node->getNodeData()->getColsMinWidth() ?>"> pixels |
32 | </div> | 32 | </div> |
33 | </div> | 33 | </div> |