Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

JS and CSS path in webresource to use in velocity template

dhaval soni
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 21, 2013

Hi,

I need to add my JS files and CSS files into velocity template.

so, i have added webresource module by follow below link:

https://developer.atlassian.com/display/CONFDEV/Web+Resource+Module

query here:

it does not seems included as it does not work and also not found in firebug.

have added it as below: please correct me what should be the location... and what's wrong.

src/main/Resource/templates/js files

src/main/Resource/templates/cs files

code:

<web-resource name="Admin Web Resources" key="resources">

<dependency>com.atlassian.auiplugin:ajs</dependency>

<resource type="download" name="admin.js" location="admin.js"/>

<!-- added below js files -->

<resource type="download" name="jquery-1.9.1.min.js" location="templates/jquery-1.9.1.min.js" />

<resource type="download" name="jquery-ui-1.10.2.custom.min.js" location="templates/jquery-ui-1.10.2.custom.min.js" />

<!-- end js files -->

</web-resource>

<!-- css files -->

<web-resource key="example-resources" name="Web Resources for Content in Editor">

<resource name="fullcalendar.css" type="download" location="templates/fullcalendar.css"/>

<resource name="fullcalendar.print.css" type="download" location="templates/fullcalendar.print.css"/>

<context>editor-content</context>

</web-resource>

Thank You,

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Tony Filipe October 8, 2013

In my Velocity template (in Jira 6.0) this worked:

$webResourceManager.requireResource("your-plugin-key:resourcekey")

(When I tried it #requireResource macro wasn't parsed but instead displayed as text on screen).

Note I didn't need to add anything to my back-end action (which extends JiraWebActionSupport) for this to work.

Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 8, 2013

You have to add this in your <head> section

&lt;html&gt;
&lt;head&gt;
$webResourceManager.requireResource("your-plugin-key:resourcekey")
...

0 votes
Higashi
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 5, 2015

You have to call for dependency. In your velocity use:

#requireResource("your-plugin-key:resourcekey")

Your-plugin-key, you can get from atlassian-plugin.xml, it's attribute "key" in root tag

&lt;atlassian-plugin key="somekey"&gt;...&lt;/atlassian-plugin&gt;

resourcekey, is "resources" from your example. key attribute from

&lt;web-resource name="Admin Web Resources" key="resources"&gt;

Hope it helps.

0 votes
Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 22, 2013

You added the dependency. But did you call it?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events