Hi,
I need to have different colours of title in the expand function. I should be able to change the colour of the title to red, green, yellow, purple, blue etc.
How can I do that?
I can't find any macros that can do that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is a user macro that does what you are wanting. You might want to fill out the style section a bit (padding, border, border-radius, etc). I've used the same colors that are used in the status macro for consistency.
Macro Name:
color_expand
Macro Title:
Color Expand
Description:
Embeds an expandable text box into your page.
Documentation URL:
http://confluence.atlassian.com/display/DOC/Expand+Macro
Macro Body Processing:
Rendered
Template:
## Developed by: My Name ## Date created: dd/mm/yyyy ## Installed by: My Name ## @param title:title=Title|type=string|default=Click here to expand...|desc= ## @param color:title=Title Background Color|type=enum|enumValues=grey,red,yellow,green,blue|desc= ############################## ## Create a unique id value ## ############################## #set( $id=$action.dateFormatter.calendar.timeInMillis ) #if ($paramcolor == "grey") #set ($backColor = "#CCCCCC") #set ($textColor = "#3B73AF") #elseif ($paramcolor == "red") #set ($backColor = "#D04437") #set ($textColor = "#FFFFFF") #elseif ($paramcolor == "yellow") #set ($backColor = "#FFD351") #set ($textColor = "#3B73AF") #elseif ($paramcolor == "green") #set ($backColor = "#14892C") #set ($textColor = "#FFFFFF") #elseif ($paramcolor == "blue") #set ($backColor = "#4A6785") #set ($textColor = "#FFFFFF") #else #set ($backColor = "transparent") #set ($textColor = "#3B73AF") #end <style type="text/css"> #exp_cnt_$id .expand-control-text { background: $backColor; color: $textColor; } </style> <div id="exp_cnt_$id"> <ac:structured-macro ac:name="expand"> #if($!paramtitle && $!paramtitle != "") <ac:parameter ac:name="title">$!paramtitle</ac:parameter> #end <ac:rich-text-body> $body </ac:rich-text-body> </ac:structured-macro> </div>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Davin, Thank you very much. Can you please help me again. I am not sure how much of the text/code I should add in the User Macro (Definition of User Macro > Template)? And when I am in WIKI Markup, which code should I write to get the function work right? What I need is this: (example with normal expand) to get af normal expand-function without colors i write: {expand:title=Title here} Text text text {expand} Thank you in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I edited my original user macro a bit(to fix a typo), so use the new one. When you are in the user maco definition the code block above is the template. Everything in that code block is part of the template. The stuff above the code block is for the other field in the user macro setup. As for wiki markup you would user this. {color_expand:title=Stuff|color=red} Blah {color_expand}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Davin,
Thank you very much.
Can you please help me again.
I am not sure how much of the text/code I should add in the User Macro (Definition of User Macro > Template)? And when I am in WIKI Markup, which code should I write to get the function work right?
What I need is this:
(example with normal expand)
to get af normal expand-function without colors i write:
{expand:title=Title here}
Text text text
{expand}
Thank you in advance.