Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to include 'show-if' macro in the Main decorator?

Nicolas Casel
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 18, 2016

By editing the 'Main Layout' decorator, I would like to include the 'show-if' macro (part of the Visibility plugin).

Is it possible? If so, what is the correct syntax?

I've tried this but it does not work:

#{show-if:[scope:french_menu>descendents]}
<div id="custom-top-menu">
<nav><ul> ... </ul></nav>
</div>
#{show-if}

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Nicolas Casel
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 26, 2016

Here is a snippet code that works:

$helper.renderConfluenceMacro('{show-if:match=any|user=userid}
{html}
<div>your content...</div>
{html}
{show-if}')

 

However, it no longer works if I add the 'scope' parameter, like:

$helper.renderConfluenceMacro('{show-if:match=any|user=userid|scope=pagetitle}
{html}
<div>your content...</div>
{html}
{show-if}')
0 votes
Marcel Woschek
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 22, 2016

Maybe you shouldn't write it in wiki markup but in the storage format.

I don't know exactly, how it looks like cause I don't use this plugin, but if you include this macro on a page and open the "view storage format"-option in the dropdown menu, you can see how the macro is stored in XHTML.

 

Nicolas Casel
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 22, 2016

Thanks @Marcel Woschek for your feedback.

The macro XHTML is:

<ac:structured-macro ac:name="hide-if"><ac:parameter ac:name="scope">french_menu&gt;descendents</ac:parameter>

So, what would be the equivalent in the decorator code editor? Unsurprisingly, a simple copy-paste does not work...

TAGS
AUG Leaders

Atlassian Community Events