Changes for page Navigation

Last modified by Benjamin Fischer on 2025/06/03 16:18

From version 4.1
edited by Benjamin Fischer
on 2024/10/24 16:39
Change comment: There is no comment for this version
To version 20.1
edited by Benjamin Fischer
on 2024/12/09 15:31
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,21 +1,13 @@
1 1  {{velocity}}
2 -#set ($depth = 3)
3 -#set ($limit = 10)
4 -#macro (navItem $rootName $level)
2 +{{html wiki="true"}}
3 +#macro (navItem $rootName $depth=4 $childsMax=15 $childsMin=1 $level=1)
5 5   #set ($rootDoc = $xwiki.getDocument($rootName))
6 6   #set ($canView = $rootDoc.hasAccess("view"))
7 7   #if ($canView)
8 - #set ($children = $rootDoc.getChildren($limit, 0))
9 - #if ($rootDoc.getContent().isEmpty() && !$children.isEmpty())
10 - $stringtool.repeat('*', $level) $rootDoc.plainTitle
11 - #else
12 - $stringtool.repeat('*', $level) {{html}}<a href="$rootDoc.getURL()">$escapetool.xml($rootDoc.plainTitle)</a>{{/html}}
13 - #end
14 - #if ($level < $depth)
15 - #foreach ($child in $children)
16 - #navItem ($child $mathtool.add($level, 1))
17 - #end
18 - #end
7 + #set ($children = $rootDoc.getChildren())
8 + #set ($nChilds = $children.size())
9 + #set ($hasChilds = (($level < $depth) && ($nChilds > 0)))
10 + <li#if($childsMin < $nChilds && $nChilds < $childsMax) class="open"#end>#if($rootDoc.getContent().isEmpty()&&$hasChilds) $rootDoc.plainTitle #else [[$rootDoc.plainTitle>>$rootDoc.fullName]] #end#if($hasChilds)<ul>#foreach($child in $children)#navItem ($child, $depth, $mathtool.sub($childsMax, $nChilds), $childsMin, $mathtool.add($level, 1))#end</ul>#end</li>
19 19   #end
20 20  #end
21 21  * [[{{icon name="home"/}}Home>>Main.WebHome]]
... ... @@ -22,13 +22,18 @@
22 22  * ----
23 23  * [[{{icon name="book"/}}Material collection>>Material collection.WebHome]]
24 24  * [[{{icon name="address-book"/}}People in ErUM-Data>>People in ErUM-Data.WebHome]]
25 -* ----
26 -#navItem ("DIG-UM.WebHome", 1)
27 -#navItem ("Internal.WebHome", 1)
17 +<li><br/></li>
18 +#navItem ("DIG-UM.WebHome")
19 +#navItem ("Internal.WebHome")
28 28  #if ($hasEdit)
29 -* ----
30 -* {{icon name="question"/}} Help
31 -** [[XWiki Syntax Guide>>XWiki.XWikiSyntax]]
32 -** [[{{icon name="font-awesome"/}} FontAwesome Icons>>https://fontawesome.com/v4/icons/]]
21 +<li><br/></li>
22 +<li class="open">{{icon name="question"/}} Help<ul>
23 +<li>[[XWiki Syntax Guide>>XWiki.XWikiSyntax]]</li>
24 +#if ($isAdvancedUser && $hasProgramming)
25 +<li>[[XWiki Scripting API>>https://www.xwiki.org/xwiki/bin/view/ScriptingDocumentation/]]</li>
33 33  #end
27 +<li>[[{{icon name="font-awesome"/}}FontAwesome Icons>>https://fontawesome.com/v4/icons/]]</li>
28 +</ul></li>
29 +#end
30 +{{/html}}
34 34  {{/velocity}}
XWiki.UIExtensionClass[0]
Cached
... ... @@ -1,0 +1,1 @@
1 +No
Asynchronous rendering
... ... @@ -1,0 +1,1 @@
1 +No
Executed Content
... ... @@ -1,6 +1,6 @@
1 1  {{velocity}}
2 2  #panelheader("Navigation")
3 -{{menu type="vertical collapsible open"
3 +{{menu type="vertical collapsible"
4 4  label="~N~a~v~i~g~a~t~i~o~n"}}{{include
5 5  reference="$uix.doc.documentReference" /}}
6 6  {{/menu}}