It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is there a way to combine a list variable and status macro in a template?

John Corwith Apr 17, 2017

I'd like to be able to configure a pick list for the status macro when using it in a template. As an example, I'd like to be able to pick Grey with the title Draft, Yellow with Submitted, Blue with In Test & Green with Completed.

1 answer

0 votes
Davin Studer Community Leader Apr 17, 2017

You can, but you need to create a user macro to do it. Here is an example of the user macro setup.

Macro Name:
template_status

Macro Title:
Template Status

Macro Body Processing:
Rendered

Template:

## Developed by: Davin Studer
## Date created: 10/20/2015
## @noparams

#if ($body && $body != "")
    #if($body == "Status 1")
        #set ($color = "aui-lozenge-success") ## greeen
    #elseif ($body == "Status 2")
        #set ($color = "aui-lozenge-current") ## yellow
    #elseif ($body == "Status 3")
        #set ($color = "aui-lozenge-error") ## red
    #elseif ($body == "Status 4")
        #set ($color = "aui-lozenge-complete") ## blue
    #else
        #set ($color = "") ## gray
    #end
<span class="status-macro aui-lozenge $color">$body</span>
#end

 

Change the values in the user macro to match the values in your template list variable. When you setup the template put the user macro on the page and put the template variable into the body of the user macro.

Status.PNG

You won't see the status macro in edit mode, but when the page is viewed you will. It will still even work with things like the page properties and page properties report macros.

John Corwith Apr 17, 2017

Thanks Devin, this is pretty great. I'll have to beg the powers that be to get my admin rights back so I can create a this macro. I think I'd go one better and make the 4 status settings configurable in the macro.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

Confluence CVEs and common questions

Two vulnerabilities have been published for Confluence Server and Data Center recently: March 20, 2019 CVE-2019-3395 / CVE-2019-3396 April 17, 2019 CVE-2019-3398 The goal of this article is...

874 views 0 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you