Changes for page Menu Macro

Last modified by Leon Poon on 2024/03/23 04:30

From version 7.1
edited by Leon Poon
on 2023/05/16 13:37
Change comment: Install extension [org.xwiki.platform:xwiki-platform-menu-ui/14.10.10]
To version 2.1
edited by Leon Poon
on 2020/01/05 05:51
Change comment: Migrated property [contentJavaType] from class [XWiki.WikiMacroClass]

Summary

Details

Page properties
Content
... ... @@ -3,11 +3,9 @@
3 3  = Horizontal Menu =
4 4  
5 5  {{velocity}}
6 -#set ($menuTemplateDoc = $xwiki.getDocument('MenuTemplate'))
7 7  {{code language="none"}}
8 8  {{menu type="horizontal fixedWidth"}}
9 -## No way to escape content in the code macro, so just remove {, see https://jira.xwiki.org/browse/XRENDERING-13.
10 -$menuTemplateDoc.content.replace('{', '')
8 +$xwiki.getDocument('MenuTemplate').content
11 11  {{/menu}}
12 12  {{/code}}
13 13  {{/velocity}}
XWiki.StyleSheetExtension[1]
Code
... ... @@ -126,6 +126,7 @@
126 126   font-size: @font-size-base;
127 127   text-align: left; // Ensures proper alignment if parent has it changed (e.g., modal footer)
128 128   background-color: @dropdown-bg;
129 + border: 1px solid @dropdown-fallback-border; // IE8 fallback
129 129   border: 1px solid @dropdown-border;
130 130   border-radius: @border-radius-base;
131 131   .box-shadow(0 6px 12px rgba(0,0,0,.175));
... ... @@ -306,33 +306,6 @@
306 306   padding-left: 15px;
307 307   & .icon-bar {
308 308   background-color: @navbar-default-link-color;
309 - transition: .3s ease all;
310 - &:nth-of-type(2) {
311 - opacity: 0;
312 - }
313 - &:nth-of-type(3) {
314 - transform: rotate(45deg);
315 - }
316 - &:nth-of-type(4) {
317 - transform: rotate(-45deg);
318 - margin-top: -2px;
319 - margin-bottom: 6px;
320 - }
321 321   }
322 - &.collapsed {
323 - .icon-bar {
324 - &:nth-of-type(2) {
325 - opacity: 1;
326 - }
327 - &:nth-of-type(3) {
328 - transform: rotate(0);
329 - }
330 - &:nth-of-type(4) {
331 - transform: rotate(0);
332 - margin-top: 4px;
333 - margin-bottom: 0;
334 - }
335 - }
336 - }
337 337   }
338 338  }
XWiki.WikiMacroClass[0]
Cached
... ... @@ -1,1 +1,0 @@
1 -No
Asynchronous rendering
... ... @@ -1,1 +1,0 @@
1 -No
Macro code
... ... @@ -9,14 +9,10 @@
9 9  #set ($discard = $xwiki.ssx.use("$xcontext.macro.doc.prefixedFullName", {'colorTheme': $colorTheme}))
10 10  #set ($discard = $xwiki.jsx.use("$xcontext.macro.doc.prefixedFullName"))
11 11  #if($type.contains('horizontal'))
12 - ## Make sure the id is non-empty for horizontal menus as otherwise the toggle doesn't work.
13 - #if ($stringtool.isBlank("$!id"))
14 - #set ($id = $wikimacro.context.getXDOM().getIdGenerator().generateUniqueId("M", "GeneratedMenuId"))
15 - #end
16 16   (% role="navigation" class="menu-horizontal-toggle" %)(((
17 17   (% class="navbar-header" %)(((
18 18   {{html}}
19 - <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#$!{escapetool.xml($id)}" aria-expanded="false">
15 + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#$!{id}" aria-expanded="false">
20 20   <span class="sr-only"></span>
21 21   <span class="icon-bar"></span>
22 22   <span class="icon-bar"></span>
... ... @@ -24,13 +24,13 @@
24 24   </button>
25 25   {{/html}}
26 26   )))
27 - (% id="$!{services.rendering.escape($id, 'xwiki/2.1')}" class="menu menu-${services.rendering.escape($!type, 'xwiki/2.1')} collapse navbar-collapse" %)(((
28 - {{wikimacrocontent/}}
23 + (% id="${id}" class="menu menu-$!type collapse navbar-collapse" %)(((
24 + $xcontext.macro.content
29 29   )))
30 30   )))
31 31  #else
32 - (% #if ("$!id" != '') id="${services.rendering.escape($id, 'xwiki/2.1')}"#end class="menu menu-${services.rendering.escape($!type, 'xwiki/2.1')}" %)(((
33 - {{wikimacrocontent/}}
28 + (% #if ("$!id" != '') id="$id"#end class="menu menu-$!type" %)(((
29 + $xcontext.macro.content
34 34   )))
35 35  #end
36 36  {{/velocity}}
Macro content type
... ... @@ -1,1 +1,0 @@
1 -Wiki
Default category
... ... @@ -1,0 +1,1 @@
1 +Navigation
Default categories
... ... @@ -1,1 +1,0 @@
1 -Navigation