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

In a user macro, how can I output each value of an @param with the "multiple" flag, and save the index of one of them?

Liviu Constantinescu September 1, 2013

I'm making a macro that displays a popup list, and if the user selects something from this popup list, the macro should remember that choice.

Here's what I've got so far:

## @param SelectedItem:title=Selected List Item|type=string|required=true|desc=Whichever item was last chosen from the list.
## @param MacroListOptions:title=Macro List Options|type=string|required=true|desc=A comma-separated list of text items.|multiple=true

#requireResource("com.atlassian.auiplugin:aui-experimental-dropdown2")

<a href="#macroList" aria-owns="macroList" aria-haspopup="true" class="aui-dropdown2-trigger aui-style-default">$paramSelectedItem</a>

<div id="macroList" class="aui-dropdown2 aui-style-default">
    <ul class="aui-list-truncate">
#foreach($listOption in $paramMacroListOptions)
        <li><a href="editMacroBody(\"$listOption\")">$listOption</a></li>
#end
    </ul>
</div><!-- macro list -->

<script><!--

function editMacroBody(selectedString) {
    // $paramSelectedItem = selectedString
}

//--></script>

All I need to finish the macro is a bit of information that I haven't been able to track down in the docs:

1. How do I implement the "foreach" loop to iterate over the values of an @param flagged with "multiple"?

2. How do I save the "SelectedItem" @param, so that it is retained when editMacroBody runs?

Thanks in advance to anyone who can help me with this.

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

Liviu Constantinescu September 4, 2013

Yes, it's definitely doable via purchasing the Scaffolding plugin or the Run Plugin, but this seems like overkill for what should be a simple operation...

Also, our Confluence install has unlimited users, which according to the pricing chart for both, appears to mean we'd have to pay infinity dollars? I've tried to get pricing info from the developer of Scaffolding, but haven't got an answer.

Liviu Constantinescu November 11, 2013

In the end, we did end up using Scaffolding, so here's your karma. =)

TAGS
AUG Leaders

Atlassian Community Events