Document Folder Tree
parent
e518759964
commit
8b93880488
|
|
@ -221,7 +221,10 @@ public class ContentSectionController {
|
|||
System.currentTimeMillis() - objectsStart
|
||||
);
|
||||
|
||||
contentSectionModel.setFolders(buildFolderTree(section, folder));
|
||||
final List<FolderTreeNode> folderTree = buildFolderTree(
|
||||
section, folder
|
||||
);
|
||||
contentSectionModel.setFolders(folderTree);
|
||||
|
||||
final long rowsStart = System.currentTimeMillis();
|
||||
documentFolderModel.setRows(
|
||||
|
|
@ -355,7 +358,10 @@ public class ContentSectionController {
|
|||
return root
|
||||
.getSubFolders()
|
||||
.stream()
|
||||
.sorted()
|
||||
.sorted(
|
||||
(folder1, folder2)
|
||||
-> folder1.getName().compareTo(folder2.getName())
|
||||
)
|
||||
.map(folder -> buildFolderTreeNode(section, currentFolderPath,
|
||||
folder))
|
||||
.collect(Collectors.toList());
|
||||
|
|
@ -378,16 +384,22 @@ public class ContentSectionController {
|
|||
node.setFolderId(folder.getObjectId());
|
||||
node.setUuid(folder.getUuid());
|
||||
node.setName(folder.getName());
|
||||
node.setPath(folderPath);
|
||||
node.setOpen(currentFolderPath.startsWith(folderPath));
|
||||
node.setSelected(currentFolderPath.equals(folderPath));
|
||||
node.setSubFolders(
|
||||
folder
|
||||
.getSubFolders()
|
||||
.stream()
|
||||
.sorted()
|
||||
.map(subFolder -> buildFolderTreeNode(section,
|
||||
currentFolderPath,
|
||||
subFolder))
|
||||
.sorted(
|
||||
(folder1, folder2)
|
||||
-> folder1.getName().compareTo(folder2.getName())
|
||||
)
|
||||
.map(
|
||||
subFolder -> buildFolderTreeNode(
|
||||
section, currentFolderPath, subFolder
|
||||
)
|
||||
)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,66 +0,0 @@
|
|||
<!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>
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE html [<!ENTITY times '×'>]>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
|
||||
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
|
||||
xmlns:cms="http://xmlns.jcp.org/jsf/composite/components/cms"
|
||||
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
|
||||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
|
||||
<ui:composition>
|
||||
<c:choose>
|
||||
<c:when test="#{not empty folder.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="##{folder.name}-subfolders"
|
||||
aria-expanded="false"
|
||||
aria-controls="##{folder.name}-subfolders"
|
||||
type="button">
|
||||
<span class="sr-only">#{CmsAdminMessages['contentsection.documentfolder.foldersnav.subfolders.expand']}
|
||||
</span>
|
||||
</button>
|
||||
<a class="pl-0"
|
||||
href="#{basePath}#{folder.path}">#{folder.name}</a>
|
||||
</div>
|
||||
<ul class="border-0 #{!folder.open ? 'collapse' : 'collapse.show'} list-group"
|
||||
id="#{folder.name}-subfolders">
|
||||
<c:forEach items="#{folder.subFolders}"
|
||||
var="subFolder">
|
||||
<ui:include src="document-folder-tree-node.xhtml">
|
||||
<ui:param name="basePath" value="#{basePath}" />
|
||||
<ui:param name="folder" value="#{subFolder}" />
|
||||
</ui:include>
|
||||
</c:forEach>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<li class="folder-tree-node list-group-item">
|
||||
<a href="#{basePath}#{folder.path}">#{folder.name}</a>
|
||||
</li>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
||||
|
|
@ -51,12 +51,20 @@
|
|||
<ul class="list-group">
|
||||
<c:forEach items="#{ContentSectionModel.folders}"
|
||||
var="folder">
|
||||
<cms:treeNode basePath="#{mvc.basePath}/#{ContentSectionModel.sectionName}/document-folders"
|
||||
<ui:include src="document-folder-tree-node.xhtml">
|
||||
<ui:param name="basePath"
|
||||
value="#{mvc.basePath}/#{ContentSectionModel.sectionName}/document-folders" />
|
||||
<ui:param name="folder" value="#{folder}" />
|
||||
</ui:include>
|
||||
|
||||
<!-- <cms:folderTreeNode basePath="#{mvc.basePath}/#{ContentSectionModel.sectionName}/document-folders"
|
||||
collapsed="#{!folder.open}"
|
||||
name="#{folder.name}"
|
||||
path="#{folder.path}"
|
||||
selected="#{folder.selected}"
|
||||
subFolders="#{folder.subFolders}" />
|
||||
subFolders="#{folder.subFolders[index]}" />-->
|
||||
<!-- <cms:folderTreeNode basePath="#{mvc.basePath}/#{ContentSectionModel.sectionName}/document-folders"
|
||||
folder="#{folder}" />-->
|
||||
</c:forEach>
|
||||
<!-- <li class="list-group-item">
|
||||
<a class="" href="#">Folder 1</a>
|
||||
|
|
|
|||
Loading…
Reference in New Issue