libreccm/ccm-cms/src/main/resources/META-INF/resources/components/cms/treeNode.xhtml

67 lines
3.2 KiB
HTML

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:cc="http://xmlns.jcp.org/jsf/composite"
xmlns:cms="http://xmlns.jcp.org/jsf/composite/components/cms">
<cc:interface shortDescription="Component for nodes in a folder tree">
<cc:attribute name="basePath"
required="true"
shortDescription="Base path (mvc.basePath and contentsection" />
<cc:attribute name="collapsed"
required="true"
shortDescription="Is the folder collapsed?"
type="boolean" />
<cc:attribute name="name"
required="true"
shortDescription="The name of the folder." />
<cc:attribute name="path"
required="true"
shortDescription="The path of the folder." />
<cc:attribute name="selected"
required="true"
shortDescription="Is the folder selected?"
type="boolean" />
<cc:attribute name="subFolders"
required="false"
type="java.util.Collection" />
</cc:interface>
<cc:implementation>
<c:choose>
<c:when test="#{not empty subFolders}">
<li class="folder-tree-node list-group-item">
<div class="d-flex">
<button class="btn btn-light p-0 subfolders-toggler"
data-toggle="collapse"
data-target="##{cc.attrs.name}-subfolders"
aria-expanded="false"
aria-controls="##{cc.attrs.name}-subfolders"
type="button">
<span class="sr-only">#{CmsAdminMessages['contentsection.documentfolder.foldersnav.subfolders.expand']}
</span>
</button>
<a class="pl-0"
href="#{cc.attrs.basePath}/#{cc.attrs.path}">#{cc.attrs.name}</a>
</div>
<ul class="border-0 #{collapsed ? 'collapse' : 'collapse.show'} list-group"
id="##{cc.attrs.name}-subfolders">
<c:forEach items="#{cc.attrs.subFolders}"
var="subFolder">
<cms:treeNode basePath="#{cc.attrs.basePath}"
collapsed="#{!subFolder.open}"
name="#{subFolder.name}"
path="#{subFolder.path}"
selected="#{subFolder.selected}"
subFolders="#{subFolder.subFolders}" />
</c:forEach>
</ul>
</li>
</c:when>
<c:otherwise>
<li class="folder-tree-node list-group-item">
<a href="#{cc.attrs.href}">#{cc.attrs.name}</a>
</li>
</c:otherwise>
</c:choose>
</cc:implementation>
</html>