Hi all,
I'm trying to include a javascript resource from a velocity template, but none of my try are working...
I have the following webresource:
<!-- add our web resources --> <web-resource key="fatca-jira-plugin-resources" name="fatca-jira-plugin Web Resources"> <dependency>com.atlassian.auiplugin:ajs</dependency> <resource type="download" name="fatca-jira-plugin.css" location="/css/fatca-jira-plugin.css" /> <resource type="download" name="fatca-jira-plugin.js" location="/js/fatca-jira-plugin.js" /> <resource type="download" name="images/" location="/images" /> <context>fatca-jira-plugin</context> </web-resource>
And on the velocity file, I tried several options:
${webResourceManager.requireResourcesForContext("fatca-jira-plugin")}
or
#requireResource("com.xxx.fatca-jira-plugin:fatca-jira-plugin-resources")
with or without "#includeResources()"
<html> <head>
<!-- missing inclusion here!! -->
<script type="text/javascript"> function load() { Fatca.openBO(); } </script> </head> <body onload="load()"> </body> </html>
Any idea? I'm really stuck on this...
Thanks in advance!!
Community moderators have prevented the ability to post new answers.
Hi,
Yeah I've tried this too... Indeed, it uses webwork1 to render, but in the final markup this instruction get discarded and not replaced with anything...
Thank you for the tip about Soy/Clojure, but my plugin will not be used for a long time (this is a one-shot, everything will go to trash in a year), so I'd like to use things I already know...
Anyway, I have workarounded it using the atl.general context in my web-resource definition. This way it works, even if it is included in a lot of pages where it shouldn't. But that is not a big issue for me :)
Should be $webResourceManager.requireResourcesForContext("fatca-jira-plugin"), it also depends what part renders the code. My answer assumes that this is rendered using webwork action.
BTW if you're starting with a new plugin I'd advise to use Soy/Clojure templates and JIRA is currently moving towards them.
What you will get is a lot of already available templates that you can re-use from JIRA and AUI. Here's a list of Soy templates available from AUI - https://bitbucket.org/atlassian/aui/src/814a20176ed3/auiplugin/src/main/resources/soy/atlassian?at=master
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Facing the same problem can not use generic contexts. I would love if someone told me proper fix for this problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't know how, but this line started working for me
-
<context>com.temp-plugin</context> #requireResourcesForContext("com.temp-plugin")
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.