Jahia / bootstrap4

This is a Bootstrap 4 implementation of http://getbootstrap.com for Digital Experience Manager
MIT License
0 stars 4 forks source link

Delete/rename node when grid is renamed #12

Closed hduchesne closed 4 years ago

hduchesne commented 4 years ago

when you rename, or change the row type (predefined or customs...) the module create new node and don't remove existing one. It would be great to rename row node or to move the content from one to another in order to keep the content and also to be sure the system doesn't create "ghost" node.

in the image below, I just change predefined grid to custom grid to select a 7/5 (new node col0 and col1) instead of 8/4 and this create a couple of dead node (main & side) I cannot see in edit mode.

rename_element

pvollenweider commented 4 years ago

And what do you suggest? Having a rule that rename sub nodes? Do you want to contribute?

pvollenweider commented 4 years ago

I think we could make it like this: As we use the areaAsSubNode on generated area, we could change it from

<template:area path="${colName}-side" areaAsSubNode="true" moduleType="${moduleType}" level="${level}"/>

to

<template:area path="side" areaAsSubNode="true" moduleType="${moduleType}" level="${level}"/>

And then create a groovy script to rename all generated subsists only once. This should be easy to refactor using such an algorithm.

forall bootstrap4nt:grid nodes
    nodename = node.name
    forall chldren of type jnt:contentList
        rename contentList 'nodename-' to ''
        rename contentList 'nodename' to 'main'

The only complex thing is to handle grids generated from the studio, because it could have more impacts...

hduchesne commented 4 years ago

maybe an easy way should be to stay with col0, col1 and don't use col-side or col-main for predefined grid and then use your script to rename.

pvollenweider commented 4 years ago

Improvement has been done in the following releases https://github.com/Jahia/bootstrap4/releases/tag/bootstrap4-modules-4.6.1 https://github.com/Jahia/bootstrap4/releases/tag/bootstrap4-modules-2.5.0