Changes for page InfoboxStyles
Last modified by Mads Pedersen on 2026/07/28 06:53
From version 8.13
edited by Mads Pedersen
on 2026/01/20 15:00
on 2026/01/20 15:00
Change comment:
There is no comment for this version
To version 8.28
edited by Mads Pedersen
on 2026/01/21 12:49
on 2026/01/21 12:49
Change comment:
There is no comment for this version
Summary
-
Objects (1 modified, 2 added, 0 removed)
Details
- XWiki.WikiMacroClass[0]
-
- Macro code
-
... ... @@ -1,7 +1,37 @@ 1 1 {{velocity}} 2 2 {{html clean="false"}} 3 -<div style="float:right; width:280px; margin:0 0 1em 1em; border:1px solid #aaa; background:#f8f9fa; font-size:0.9em; font-family: sans-serif; line-height: 1.5; box-shadow: 0 2px 4px rgba(0,0,0,0.1);"> 4 - <table style="width:100%; border-collapse:collapse;"> 3 + 4 +#set($width = $xcontext.macro.params.width) 5 +#set($labelWidth = $xcontext.macro.params.labelWidth) 6 + 7 +## Default values if parameters are missing 8 +#if("$!width" == "") #set($width = "22") #end 9 +#if("$!labelWidth" == "") #set($labelWidth = "35%") #end 10 + 11 +<style> 12 + .custom-infobox { 13 + float: right; 14 + margin: 0 0 1em 1em; 15 + border: 1px solid #aaa; 16 + background: #f8f9fa; 17 + font-size: 0.9em; 18 + font-family: sans-serif; 19 + line-height: 1.5; 20 + box-shadow: 0 2px 4px rgba(0,0,0,0.1); 21 + } 22 + 23 + @media print { 24 + .custom-infobox { 25 + float: none !important; 26 + width: 100% !important; 27 + margin: 1em 0 !important; 28 + box-shadow: none !important; 29 + } 30 + } 31 +</style> 32 + 33 +<div class="custom-infobox" style="width:${width}rem;"> 34 + <table style="width:100%; border-collapse:collapse; table-layout: fixed;"> 5 5 ## Header 6 6 #if($xcontext.macro.params.title && "$!xcontext.macro.params.title" != "") 7 7 <caption style="background:#eeeeee; font-weight:bold; padding:10px; border:1px solid #aaa; border-bottom:none; color: #000;"> ... ... @@ -21,7 +21,7 @@ 21 21 </tr> 22 22 #end 23 23 24 - ## Parse the Macro Content (The big box)54 + ## Parse the Macro Content 25 25 #set($macroContent = $xcontext.macro.content) 26 26 #if($macroContent && "$!macroContent.trim()" != "") 27 27 #foreach($line in $macroContent.split("\n")) ... ... @@ -29,10 +29,10 @@ 29 29 #if($trimmedLine.contains("=") && $trimmedLine.length() > 2) 30 30 #set($parts = $trimmedLine.split("=", 2)) 31 31 <tr> 32 - <th style="border-top:1px solid #ddd; padding:8px; text-align:left; background:#f9f9f9; width: 35%; vertical-align: top; font-weight: 600;">62 + <th style="border-top:1px solid #ddd; padding:8px; text-align:left; background:#f9f9f9; width:${labelWidth}; vertical-align: top; font-weight: 600; word-break: break-word;"> 33 33 $parts[0].trim() 34 34 </th> 35 - <td style="border-top:1px solid #ddd; padding:8px; vertical-align: top; background: #fff;"> 65 + <td style="border-top:1px solid #ddd; padding:8px; vertical-align: top; background: #fff; word-break: break-word;"> 36 36 $parts[1].trim() 37 37 </td> 38 38 </tr>
- XWiki.WikiMacroParameterClass[3]
-
- Parameter description
-
... ... @@ -1,0 +1,1 @@ 1 +The width of the box. Default 20 - Parameter name
-
... ... @@ -1,0 +1,1 @@ 1 +width
- XWiki.WikiMacroParameterClass[4]
-
- Parameter description
-
... ... @@ -1,0 +1,1 @@ 1 +Width of the left column, defaults to 35% - Parameter name
-
... ... @@ -1,0 +1,1 @@ 1 +labelWidth