I want to use a js file in my plugin . so i add
<web-resource key="myresource" name="Myresource" > <dependency>com.atlassian.auiplugin:ajs</dependency> <dependency>jira.webresources:jira-global</dependency> <dependency>jira.webresources:autocomplete</dependency> <resource type="download" name="test.js" location="javascripts/test.js"> <property key="content-type" value="text/javascript"/> </resource> <context>page</context> </web-resource>
to the atlassian-plugin.xml . Then I use #requireResource("com.jira.plugin:myresource") in my gadget xml file . But it seems doesn't work . and test.js just includes alert("haha");
Does any one know how to add a external resource to the plugin ?? Thanks .
firstly,you ensure the prefix "com.jira.plugin" is the key of your plugin.
secondly,you try to modify the <context> to "<context>alt.general</context>"
this is my jira web-source's definition:
<web-resource key="myWorklogResource" name="myWorklogResource" > <description>this web-resource is for creating or editing the work log about budget selector</description> <dependency>com.atlassian.auiplugin:ajs</dependency> <dependency>com.atlassian.auiplugin:jquery</dependency> <resource type="download" name="budgetselector.js" location="javascript/budgetselector.js"/> <resource type="download" name="budgetselector.css" location="css/budgetselector.css"/> <context>atl.general</context> </web-resource>
and it works .
good luck
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi. I can't run the javascript too. I'm using JIRA 7.2 and I'm trying to create a page in the JIRA admin add-ons to keep some data using active objects, but for now I'm only want to understand how to execute the javascript.
<web-resource key="asb-resources" name="asb Web Resources"> <dependency>com.atlassian.auiplugin:ajs</dependency> <resource type="download" name="asb.css" location="/css/asb.css" /> <resource type="download" name="asb.js" location="/js/asb.js" /> <resource type="download" name="images/" location="/images" /> <context>atl.admin</context> </web-resource> <web-section name="asbSettings" i18n-name-key="asb-admin-settings.name" key="asb-admin-settings" location="admin_plugins_menu" weight="1000"> <description key="asb-admin-settings.description">Settings for asb plugins</description> <label key="asb-admin-settings.label">asb Admin Settings</label> </web-section> <web-item name="abLink" i18n-name-key="ab-link.name" key="ab-link" section="admin_plugins_menu/asb-admin-settings" weight="100"> <description key="ab-link.description">Administration of connections with AB</description> <label key="ab-link.label">AB Link</label> <link linkId="ab-link-link">/secure/ListABLink!default.jspa</link> </web-item>
The link in the web-item send to a velocity template where I'm trying to create a pop-up when the user click in a button. I put some console.log and alert in the asb.js, but nothing happen.
Anyone know what is wrong here?
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
I learned that You have to use
<meta name="decorator" content="atl.admin" />
within your .vm file to have JS loading and excuting.
every other one like
<meta name="decorator" content="atl.general" />
only loads the CSS part of your webresource.
Hope this helps!
regards,
Hans
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The log shows " Cannot find web resource module for: com.jira.plugin:myresource ".
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.