How to include web resources in Atlassian Jira plugin?
atlassian-plugin.xml:
<web-resource key="statistics-resources" name="statistics"> <resource type="download" name="statistics.js" location="js/statistics/statistics.js"/> <dependency>jira.webresources:jira-global</dependency> <context>com.cs.jira.plugins.statistics-resources</context> </web-resource>
statistics.js:
$("#projects").change(function() { $(location).attr('href', "/jira/secure/StatisticsModuleAction!project.jspa?project=" + $(this).find("option:selected").text());});
Including resources in Velocity template:
$webResourceManager.requireResourcesForContext("com.cs.jira.plugins.statistics-resources")
When i try to call javascript function from my statistics.js, i get this error:
> Uncaught TypeError: Property '$' of object [object Window] is not a function
Then i tried to include external jQuery library:
<web-resource key="statistics-resources" name="statistics"> <resource type="download" name="jquery-1.8.2.js" location="js/lib/jquery-1.8.2.js"/> <resource type="download" name="statistics.js" location="js/statistics/statistics.js"/> <dependency>jira.webresources:jira-global</dependency> <context>com.cs.jira.plugins.statistics-resources</context> </web-resource>
i got another error in batch.js:
> Uncaught TypeError: Object [object Object] has no method 'handleAccessKeys'
How can i include my resources properly?
Community moderators have prevented the ability to post new answers.
The built in jQuery that Atlassian has requires AJS.$ instead of just $. Give that a try.
It's works, thanks. Now how can I include to the my plugin images, such as icons of type of issues?
<web-resource key="statistics-resources" name="statistics"> <resource type="download" name="statistics.js" location="js/statistics/statistics.js"/> <resource type="download" name="icons" location="/images/icons/"/> <dependency>jira.webresources:jira-global</dependency> <context>com.cs.jira.plugins.statistics-resources</context> </web-resource>
<img src="$issue.getIssueType().getIconUrlHtml()"alt="$issue.getIssueType().getName()"/>
Doesn't work for me :(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.