Hey together,
so I’m having some issues implementing my Soy template into my plugin.
The following is present:
plugin.xml
<web-resource key="library-management-resource-module" name="Wfenhance Library Management resource module">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<dependency>com.atlassian.auiplugin:aui-select2</dependency>
<dependency>com.atlassian.auiplugin:aui-experimental-soy-templates</dependency>
<transformation extension="soy">
<transformer key="soyTransformer">
<functions>com.atlassian.confluence.plugins.soy:soy-core-functions</functions>
</transformer>
</transformation>
<resource type="download" name="responsible-user-search.js" location="/js/responsible-user-search.js"/>
<resource type="download" name="respusersearch-soy.js" location="/templates/respusersearch.soy"/>
<context>jira-wfenhance</context>
</web-resource>
respusersearch.soy
{namespace JIRA.Templates.wfenhance}
{template .userSearch}
<form class="aui" id="kdp-user-select-form">
<div class="field-group">
<label for="kdp-user-select">Users</label>
<div id="kdp-user-select"
name="kdp-user-select"
class="kdp-aui-select"
multiple=""
placeholder="start typing a username ...">
</div>
<div class="description">The users that should have kitchen duty.</div>
</div>
<div class="buttons-container">
<div class="buttons">
<input class="button submit" type="submit"
id="kdp-user-select-save-button"
value="show"/>
</div>
</div>
</form>
{/template}
success.vm (view where the template should appear)
<html>
<head>
<title>$i18n.getText("wfenhance.library-management.title")</title>
<meta name="decorator" content="atl.admin">
</head>
<body>`Preformatted text`
<h1>$i18n.getText("wfenhance.library-management.headline")</h1>
<div id="kdp-user-select-form"></div>
<p>Here you can manage your present library definitions and import or export them.</p>
</body>
</html>
The js file (responsible-user-search.js)
/**
* Created by schol on 7/4/2017.
*/
var initUserSearch = function() {
/* The following line is fine, I can see it has objects. However, my own is missing. */
var test1 = JIRA.Templates;
/* Consequently, the following line returns the described error */
var templateUserSearch = JIRA.Templates.wfenhance.userSearch();
};
AJS.toInit(function(){
require(['aui/flag'], function(flag) {
var myFlag = flag({
type: 'success',
title: 'JIRA Wfenhance Responsible user search',
body: 'JIRA Wfenhance Responsible user search controller is working'
});
});
initUserSearch()
})
Someone has an idea where something could be wrong?
I can see that the template doesn’t get found in the Dev Console.
I noticed my namespace seemingly can’t be found.
I don’t think it’s related to my resource as other code from the JavaScript file works (the flag shows up).
Greetings Marcus