Expand-cards is a user macro which is an enhancement version of expand macro. Expand-cards change styles of a default expand so that user can manage page length while contrasting the content.
Expand macro to hide extra content from the first appearance of the page. Expand-cards macro allow users to hide their content while providing a hint about the hidden context to the readers.
In case users’ need to avoid lengthy content from confluence pages; while providing readers a sense about the content that is hidden expand-cards macro would be the handiest tool available.
Key features
How to use
Code
always welcome to make the code more efficient. I am not a developer ;) ...
## Developed by: Alana Fernando
## Date created: 27/07/2017
##Shared with love...
## @param Status:title=Style type|type=enum|required=true|enumValues=Default,Success,Primary,Danger,Info,Warning|desc=Choose a status.
## @param title:title=Note title|type=string|desc=Title to display|required=true|option-showValueInPlaceholder=true
## @param exptitle:title=Expand title|type=string|desc=Title to display in expand|required=true
## @param summary:title=Note summary|type=string|desc=Summary to display|required=true
## @param icon:title=Note icon|type=enum|desc=Choose note icon. |enumValues=editor-task,workflow,quote,version,workbox,like,group,email,edit,comment,add,editor-mention,devtools-file
#if ( $paramStatus == "Success" )
#if ($paramtitle.length() > 120)//additional code to limit title length
<div class="aui-message aui-message-error">
<p class="title">
<strong>Error</strong>
</p>
<p>Macro parameter "input" must be 10 characters or less!</p>
</div>
#else
<div class="notice notice-success">
<h1 style="color:#80D651;"><span class="aui-icon aui-icon-small aui-iconfont-$paramicon"> </span> $paramtitle</h1>
<ac:macro ac:name="expand">
<ac:parameter ac:name="title">${paramexptitle}</ac:parameter>
<ac:rich-text-body>
<ac:default-parameter>${body}</ac:default-parameter>
</ac:rich-text-body>
</ac:macro>
#if (!$paramsummary.isEmpty())
<div style="color:#90A4AE;">$paramsummary</div>
#else
<div style="color:#90A4AE;"></div>
#end
#end
</div>
#elseif ( $paramStatus == "Danger" )
<div class="notice notice-danger">
<h1 style="color:#d73814;"><span class="aui-icon aui-icon-small aui-iconfont-$paramicon"> </span> $paramtitle</h1>
#if (!$paramsummary.isEmpty())
<div style="color:#90A4AE;">$paramsummary</div>
#else
<div style="color:#90A4AE;"></div>
#end
<ac:macro ac:name="expand">
<ac:parameter ac:name="title">${paramexptitle}</ac:parameter>
<ac:rich-text-body>
<ac:default-parameter>${body}</ac:default-parameter>
</ac:rich-text-body>
</ac:macro>
</div>
#elseif ( $paramStatus == "Info" )
<div class="notice notice-info">
<h1 style="color: #45ABCD;"><span class="aui-icon aui-icon-small aui-iconfont-$paramicon"> </span> $paramtitle</h1>
#if (!$paramsummary.isEmpty())
<div style="color:#90A4AE;">$paramsummary</div>
#else
<div style="color:#90A4AE;"></div>
#end
<ac:macro ac:name="expand">
<ac:parameter ac:name="title">${paramexptitle}</ac:parameter>
<ac:rich-text-body>
<ac:default-parameter>${body}</ac:default-parameter>
</ac:rich-text-body>
</ac:macro>
</div>
#elseif ( $paramStatus == "Warning" )
<div class="notice notice-warning">
<h1 style="color:#FEAF20;"><span class="aui-icon aui-icon-small aui-iconfont-$paramicon"> </span> $paramtitle</h1>
#if (!$paramsummary.isEmpty())
<div style="color:#90A4AE;">$paramsummary</div>
#else
<div style="color:#90A4AE;"></div>
#end
<ac:macro ac:name="expand">
<ac:parameter ac:name="title">${paramexptitle}</ac:parameter>
<ac:rich-text-body>
<ac:default-parameter>${body}</ac:default-parameter>
</ac:rich-text-body>
</ac:macro>
</div>
#elseif ( $paramStatus == "Primary" )
<div class="notice notice-primary">
<h1 style="color:#428bca;"><span class="aui-icon aui-icon-small aui-iconfont-$paramicon"> </span> $paramtitle</h1>
#if (!$paramsummary.isEmpty())
<div style="color:#90A4AE;">$paramsummary</div>
#else
<div style="color:#90A4AE;"></div>
#end
<ac:macro ac:name="expand">
<ac:parameter ac:name="title">${paramexptitle}</ac:parameter>
<ac:rich-text-body>
<ac:default-parameter>${body}</ac:default-parameter>
</ac:rich-text-body>
</ac:macro>
</div>
#elseif ( $paramStatus == "Default" )
<div class="notice notice-default">
<h1 style="color:#546E7A;"><span class="aui-icon aui-icon-small aui-iconfont-$paramicon"> </span> $paramtitle</h1>
#if (!$paramsummary.isEmpty())
<div style="color:#90A4AE;">$paramsummary</div>
#else
<div style="color:#90A4AE;"></div>
#end
<ac:macro ac:name="expand">
<ac:parameter ac:name="title">${paramexptitle}</ac:parameter>
<ac:rich-text-body>
<ac:default-parameter>${body}</ac:default-parameter>
</ac:rich-text-body>
</ac:macro>
</div>
#else
<div>$body</div>
#end
<style>
.notice {
padding: 15px;
background-color: #fafafa;
border-left: 6px solid #7f7f84;
margin-bottom: 10px;
-webkit-box-shadow: 0 5px 8px -6px rgba(0,0,0,.2);
-moz-box-shadow: 0 5px 8px -6px rgba(0,0,0,.2);
box-shadow: 0 5px 8px -6px rgba(0,0,0,.2);
}
.notice-lg {
padding: 35px;
font-size: large;
}
.notice-success {
border-color: #80D651;
}
.notice-info {
border-color: #45ABCD;
}
.notice-warning {
border-color: #FEAF20;
}
.notice-danger {
border-color: #d73814;
}
.notice-primary {
border-color: #428bca;
}
.notice-default {
border-color: #546E7A;
}
</style>
Adding user macro
Remember to select Rendered as macro body processing.
DIVE DEEP...
Gain
Macro testing
Notes and texts are use in almost everywhere in confluence. Considering usage; below test scenarios executed.
Macro deployment
Expand cards macro is deployed as a user macro. It required no system down time and you just have to add macro code to confluence as a user macro.
Make it grow and glow ...
Expand cards macro currently supports only few styles and changes. It would be nice to have an option to change styles of a note according to user’s choice with color picker.
Love to hear your comments , suggestions on this.
Alana Fernando
QA Analyst
MillenniumIT
Sri Lanka
34 accepted answers
4 comments