I want to add a Configuration Form to my Confluence Plugin So i have been following the Tutorial
https://developer.atlassian.com/display/CONFDEV/Creating+a+Cross-Platform+Admin+Configuration+Form
However at step 4 where you start creating the Velocity Template im running into issues that the Javascript Resource file is not being included in the generated page.
I downloaded the completted tutorial source and it has the same problem. When i added
$webResourceManager.requireResource("com.atlassian.plugins.tutorial.xproduct-admin-ui-plugin:resources")
<meta name="decorator" content="atl.admin" />
to the template definition the generated form is now wrapped in the standard confluece look and feel etc but the meta definition for the application-base-url no longer are included. The same if i define the actual javascript page manually using a script tag
eg <script type="text/javascript" src="/confluence/s/170/1.0/1/_/download/resources/com.organisation.myplugin:resources/admin.js" ></script>
the same affects the source code for the tutorial
<head> <title>$i18n.getText("xproduct.admin.label")</title> $webResourceManager.requireResource("com.atlassian.plugins.tutorial.xproduct-admin-ui-plugin:resources") <meta name="decorator" content="atl.admin" /> <meta name="application-base-url" content="$applicationProperties.getBaseUrl()"> </head>
So my Question is What is Wrong in the tutorial. How would i correct the tutorial code so that it works correctly... then i can apply that to my own plugin.
Community moderators have prevented the ability to post new answers.
The decorator is needed for the webResourceManager to work. Also you do not need to include
<meta name="application-base-url" content="$applicationProperties.getBaseUrl()">
Decorator itself puts
<meta name="ajs-base-url" content="YOUR-BASE-PATH"> <meta id="confluence-base-url" name="confluence-base-url" content="YOUR-BASE-PATH">
and other metas, which you can get with JS as following
AJS.$('meta[name=ajs-base-url]').attr("content")
Turns out I still had the line
<meta name="application-base-url" content="$applicationProperties.getBaseUrl()">
in my atlassian-plugin.xml which. After removing it the javascript started to work.
I also had to change the
var baseUrl = AJS.$("meta[name='application-base-url']").attr("content");
to
var baseUrl = AJS.$("meta[name='confluence-base-url']").attr("content");
in admin.js because the URL would resolve to a URL where there REST stuff was not reachable.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hm. More than a year later I seem to have run into the exact same problem. The javascript resource file is not included into the velocity template. Therefore all the ajax calls to save/put the data don't work.
Documentation seems to be outdated at many places here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.