I am attempting to write a Jira web resource plugin, but can't figure out the magic string for the dependency name so that I can use a specific Javascript file. The file I want to use is located in C:\Program Files\Atlassian\JIRA\atlassian-jira\includes\jquery\plugins\color\color-min.js (or just color.js). I already have included the dependency com.atlassian.plugins.jquery:jquery. How do I ensure this other Javascript file is available by the time my Javascript gets run? I have tried com.atlassian.plugins.jquery:color and com.atlassian.plugins.color:color, without success. In general, where are these magic strings defined?
My atlassian-plugin.xml file looks like:
<atlassian-plugin ...>
<plugin-info>
...
</plugin-info>
<web-resource name="my resources" key="my-key">
<dependency>com.atlassian.plugins.jquery:jquery</dependency>
<resource type="download" name="my.js" location="js/my.js" />
<context>atl.general</context>
</web-resource>
</atlassian-plugin>
An my.js looks like:
var WHITE = $.Color(255, 255, 255);
How can I modify either atlassian-plugin.xml or my.js to ensure that the color-min.js script has been loaded prior to declaring the global WHITE variable?
Hello,
You need to load your resources either in vm or soy template. For vm it would be like this:
$webResourceManager.requireResourcesForContext("pluginkey:jira-plugin-resources")
Forgive my ignorance (I am new to developing Jira plugins), but I don't understand your answer. I have updated the question with more details about my specific use case. Do I just need to add this line to my Javascript file? What exactly does that line do? Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.