Skip to content

Instantly share code, notes, and snippets.

@dvdsmpsn
Last active May 23, 2018 23:19
Show Gist options
  • Save dvdsmpsn/6606548 to your computer and use it in GitHub Desktop.
Save dvdsmpsn/6606548 to your computer and use it in GitHub Desktop.
AUI Button - Confluence user macro
## aui-button
##
## Macro title: AUI Button
## Macro has a body: N
## Output: HTML
##
## Developed by: David Simpson <[email protected]>
## Date created: 2013-09-18
## Installed by: Your Name
### aui-button
## @param Title:title=Button Title|type=string|required=true
## @param Href:title=Link URL|type=string|required=true
## @param Type:title=Button Type|type=enum|enumValues=Normal,Primary,Subtle,Icon|required=true
## @param IconClass:title=Icon Class|type=string|required=false|desc=For icon type buttons only. Add the AUI class for the required icon
#set($href = $paramHref)
#set($title = $paramTitle)
## Note: Confluence sanitises classes on anchors, so we have to wrap the anchor in a span
<span class="aui-button #if ($paramType =="Primary") aui-button-primary #elseif ($paramType =="Subtle") aui-button-subtle #end">
<a href="${href}">
#if ($paramIconClass) <span class="aui-icon aui-icon-small $paramIconClass">*</span> #end
${title}
</a>
## A little style fixing. Can be done inline (but will be repeated for every button on the page) or once in a custom stylesheet.
## Note, this is nested here so that aui-button-container can use the ".aui-button-container span:last-child" selector
## for styling the rounded corners on thelast button
<style>
.aui-button a, .aui-button a:hover { text-decoration: none; color: #000; }
.aui-button.aui-button-primary a { color: #fff; }
</style>
</span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment