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

Visualizing parameters in a Confluence macro

DanielM
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.
September 10, 2013

So I'm trying to add parameter fields to the macro created from following this -> https://developer.atlassian.com/display/CONFDEV/Creating+a+New+Confluence+Macro tutorial.

From what I gathered I should add the parameters in the atlassian-plugin.xml like so:

<xhtml-macro name="tutorial-confluence-macro-demo"
		class="com.example.plugins.tutorial.confluence.ExampleMacro"
		icon="/download/resources/${project.groupId}.${project.artifactId}/images/browserLogo.png"
		key="my-macro">
		<parameters>
			<parameter name="issueKey" type="String" required="true" />
		</parameters>
	</xhtml-macro>

And there should be a visible parameter field when I select the macro and try to add it, but as you can see - there isn't. What am I doing wrong? I read something about having to add javascript and/or i18n label + description, but I have no idea where and how to do that. Can someone please explain what I have to do to achieve my goal?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

4 votes
Answer accepted
DanielM
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.
September 11, 2013

So after some research, watching some videos and reading some slides from atlassiancamp and going through bitbucket to search for some examples I found where the problem was.

For the parameter to have a visible field and a label/description you need to add some information in the internationalisation file (i18n), the location of which you can check in the atlassian-plugin.xml file, for example:

<!-- add our i18n resource -->
<resource type="i18n" name="i18n" location="confluence-clientinfo-plugin" />
In this case the file is confluence-clientinfo-plugin.properties and is located in the resource folder of your plugin.
In that file, among other things, you can add descriptions and labels to your plugin/macro and it's components which you do by following this pattern:
groupID.artifactID.macroKey.label=The Name of the macro
groupID.artifactID.macroKey.desc=The Description of the macro

groupID.artifactID.macroKey.param.paramName.label=Some Label (this is what you need to make your parameter field visible)
groupID.artifactID.macroKey.param.paramName.desc=Some Description

I hope this saves inexperienced people like me some time.

Here are links to the sources I used to figure this out:
http://www.slideshare.net/GoAtlassian/pimp-my-confluence-plugin-atlascamp-2011
https://www.atlassian.com/en/company/about/events/atlascamp/2010/day2/making-confluence-macros-easy

And an example of a confluence macro:
https://bitbucket.org/rthomas/confluence-status-macro/src/3c01673e130c?at=default

TAGS
AUG Leaders

Atlassian Community Events