Jahia / bootstrap4

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

curentPageNode is not manage properly in navigation #2

Closed hduchesne closed 4 years ago

hduchesne commented 4 years ago

<c:set var="curentPageNode" value="${jcr:getMeAndParentsOfType(renderContext.mainResource.node,'jnt:page')}"/> return an array but is not managed as his.

e.g. If I create this hierarchy Page Lvl0 -> Lvl1 -> Lvl2

if I add a navbar in Lvl2 and select currentPage as starting point, curentPageNode is equals to [node /sites/i8/lvl0/lvl1/lvl2, node /sites/i8/lvl0/lvl1, node /sites/i8/lvl0]

to fix this we have to check if currentPage is not empty and extract the first element

<c:if test="${fn:length(curentPageNode) > 0}">
    <c:set var="curentPageNode" value="${curentPageNode[0]}"/>
</c:if>
pvollenweider commented 4 years ago

Why not this? <c:set var="curentPageNode" value="${renderContext.mainResource.node}"/>

hduchesne commented 4 years ago

I thought about it, but if mainRessource is not a page, we can be in trouble. after we can also do a test...

pvollenweider commented 4 years ago

Please test my pull request #3 or create a new one if needed.

hduchesne commented 4 years ago

works

pvollenweider commented 4 years ago

I closed this PR; the link for to parent page (site node) does not work. Maybe we should link to the homepage.

pvollenweider commented 4 years ago

Please check if PR #4 fix this issue