Changes for page Menu Macro

Last modified by teamwire005 on 2025/05/06 07:37

From version 8.1
edited by teamwire004
on 2024/07/12 13:15
Change comment: There is no comment for this version
To version 1.1
edited by teamwire-admin
on 2020/08/26 13:09
Change comment: Install extension [org.xwiki.platform:xwiki-platform-menu-ui/11.10.8]

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.teamwire004
1 +XWiki.teamwire-admin
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));
XWiki.WikiMacroClass[0]
Macro code
... ... @@ -1,7 +1,6 @@
1 1  {{velocity}}
2 2  #set ($id = $xcontext.macro.params.id)
3 3  #set ($type = $xcontext.macro.params.type)
4 -#set ($label = $xcontext.macro.params.label)
5 5  #set ($colorTheme = $xwiki.getUserPreference('colorTheme'))
6 6  #if ("$!colorTheme" != '')
7 7   ## Make sure we use an absolute reference (see XWIKI-9672)
... ... @@ -9,24 +9,12 @@
9 9  #end
10 10  #set ($discard = $xwiki.ssx.use("$xcontext.macro.doc.prefixedFullName", {'colorTheme': $colorTheme}))
11 11  #set ($discard = $xwiki.jsx.use("$xcontext.macro.doc.prefixedFullName"))
12 -## Make sure the label is non-empty as otherwise the aria-label doesn't work.
13 -#if ("$!label" != '')
14 - #set ($label = $wikimacro.context.getXDOM().getIdGenerator().generateUniqueId('Menu',''))
15 -#end
16 16  #if($type.contains('horizontal'))
17 - ## Make sure the id is non-empty for horizontal menus as otherwise the toggle doesn't work.
18 - #if ("$!id" == '')
19 - #set ($id = $wikimacro.context.getXDOM().getIdGenerator().generateUniqueId("M", "GeneratedMenuId"))
20 - #end
21 - (% role='navigation' class='menu-horizontal-toggle'
22 - aria-label="${services.rendering.escape($label, 'xwiki/2.1')}" %)(((
12 + (% role="navigation" class="menu-horizontal-toggle" %)(((
23 23   (% class="navbar-header" %)(((
24 24   {{html}}
25 - <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#$!{escapetool.xml($id)}"
26 - aria-expanded="false" aria-controls="$!{escapetool.xml($id)}">
27 - <span class="sr-only">
28 - $escapetool.xml($services.localization.render('menu.ui.horizontal.toggler.description'))
29 - </span>
15 + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#$!{id}" aria-expanded="false">
16 + <span class="sr-only"></span>
30 30   <span class="icon-bar"></span>
31 31   <span class="icon-bar"></span>
32 32   <span class="icon-bar"></span>
... ... @@ -33,14 +33,13 @@
33 33   </button>
34 34   {{/html}}
35 35   )))
36 - (% id="$!{services.rendering.escape($id, 'xwiki/2.1')}" class="menu menu-${services.rendering.escape($!type, 'xwiki/2.1')} collapse navbar-collapse" role="navigation" %)(((
37 - {{wikimacrocontent/}}
23 + (% id="${id}" class="menu menu-$!type collapse navbar-collapse" %)(((
24 + $xcontext.macro.content
38 38   )))
39 39   )))
40 40  #else
41 - (% role="navigation" #if ("$!id" != '') id="${services.rendering.escape($id, 'xwiki/2.1')}"#end class="menu menu-${services.rendering.escape($!type, 'xwiki/2.1')}"
42 - aria-label="${services.rendering.escape($label, 'xwiki/2.1')}" %)(((
43 - {{wikimacrocontent/}}
28 + (% #if ("$!id" != '') id="$id"#end class="menu menu-$!type" %)(((
29 + $xcontext.macro.content
44 44   )))
45 45  #end
46 46  {{/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
XWiki.WikiMacroParameterClass[3]
Parameter description
... ... @@ -1,1 +1,0 @@
1 -Optional menu label used to describe the content of the menu.
Parameter mandatory
... ... @@ -1,1 +1,0 @@
1 -No
Parameter name
... ... @@ -1,1 +1,0 @@
1 -label