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

Report Plugin Resources CSS and JS

Nabil Sayegh
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 26, 2014

I'm using JIRA 5.2.8 and write a custom report plugin with this tutorial: https://developer.atlassian.com/display/JIRADEV/Creating+a+JIRA+Report

So far everything works fine, but the css and js resources aren't loaded:

<web-resource key="jira-report-plugin-resources" name="jira-report-plugin Web Resources">
    <dependency>com.atlassian.auiplugin:ajs</dependency>
    <resource type="download" name="jira-report-plugin.css" location="/css/jira-report-plugin.css"/>
    <resource type="download" name="jira-report-plugin.js" location="/js/jira-report-plugin.js"/>
    <resource type="download" name="images/" location="/images"/>
    <context>jira-report-plugin</context>
  </web-resource>

At least not inside the report. What can I do to include resources in my report?

Adding the resources to the global context atl.general is not an option, as it would increase the traffic for each and every page view and not only for the report.

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Nabil Sayegh
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 27, 2014

Got it!

If you define it in atlassian-plugin.xml with:

<context>jira-report-plugin</context>

You can use this in Velocity templates:

$webResourceManager.requireResourcesForContext("jira-report-plugin")
0 votes
Satyendra Narwane
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 27, 2014

You can add it to the velocity file directly.

Nabil Sayegh
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 27, 2014

Thank you, but I already figured out how to include the resources correctly.

0 votes
Satyendra Narwane
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 26, 2014

Hi Nabil Sayegh,

Add resource in this way

<resource type="download" name="jira-report-plugin.css" location="css/jira-report-plugin.css"/>

<context>atl.general</context>

<context>atl.admin</context>

or

you can add it directly into velocity file as below this is for formating table.

<head>

<style type="text/css">

.CSSTableGenerator {

margin:0px;padding:0px;

width:50%;box-shadow: 10px 10px 5px #888888;

border:1px solid #ffffff;

-moz-border-radius-bottomleft:0px;

-webkit-border-bottom-left-radius:0px;

border-bottom-left-radius:0px;

-moz-border-radius-bottomright:0px;

-webkit-border-bottom-right-radius:0px;

border-bottom-right-radius:0px;

-moz-border-radius-topright:0px;

-webkit-border-top-right-radius:0px;

border-top-right-radius:0px;

-moz-border-radius-topleft:0px;

-webkit-border-top-left-radius:0px;

border-top-left-radius:0px;

}.CSSTableGenerator table{

width:50%;

height:100%;

margin:0px;padding:0px;

}.CSSTableGenerator tr:last-child td:last-child {

-moz-border-radius-bottomright:0px;

-webkit-border-bottom-right-radius:0px;

border-bottom-right-radius:0px;

}

.CSSTableGenerator table tr:first-child td:first-child {

-moz-border-radius-topleft:0px;

-webkit-border-top-left-radius:0px;

border-top-left-radius:0px;

}

.CSSTableGenerator table tr:first-child td:last-child {

-moz-border-radius-topright:0px;

-webkit-border-top-right-radius:0px;

border-top-right-radius:0px;

}.CSSTableGenerator tr:last-child td:first-child{

-moz-border-radius-bottomleft:0px;

-webkit-border-bottom-left-radius:0px;

border-bottom-left-radius:0px;

}.CSSTableGenerator tr:hover td{

background-color:#cccccc;

}

.CSSTableGenerator td{

vertical-align:middle;

background-color:#6699cc;

border:1px solid #ffffff;

border-width:0px 1px 1px 0px;

text-align:left;

padding:7px;

font-size:14px;

font-family:Arial;

font-weight:normal;

color:#000000;

}.CSSTableGenerator tr:last-child td{

border-width:0px 1px 0px 0px;

}.CSSTableGenerator tr td:last-child{

border-width:0px 0px 1px 0px;

}.CSSTableGenerator tr:last-child td:last-child{

border-width:0px 0px 0px 0px;

}

.CSSTableGenerator tr:first-child td{

background:-o-linear-gradient(bottom, #003366 5%, #003f7f 100%);background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #003366), color-stop(1, #003f7f) );background:-moz-linear-gradient( center top, #003366 5%, #003f7f 100% );filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#003366", endColorstr="#003f7f");background: -o-linear-gradient(top,#003366,003f7f);

background-color:#003366;

border:0px solid #ffffff;

text-align:center;

border-width:0px 0px 1px 1px;

font-size:16px;

font-family:Arial;

font-weight:bold;

color:#ffffff;

}

.CSSTableGenerator tr:first-child:hover td{

background:-o-linear-gradient(bottom, #003366 5%, #003f7f 100%);background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #003366), color-stop(1, #003f7f) );background:-moz-linear-gradient( center top, #003366 5%, #003f7f 100% );filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#003366", endColorstr="#003f7f");background: -o-linear-gradient(top,#003366,003f7f);

background-color:#003366;

}

.CSSTableGenerator tr:first-child td:first-child{

border-width:0px 0px 1px 0px;

}

.CSSTableGenerator tr:first-child td:last-child{

border-width:0px 0px 1px 1px;

}

</style>

</head>

Nabil Sayegh
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 27, 2014

Thank you. While adding the global contexts as you suggest works as a workaround, it is still somewhat unsatisfactory as it will add the resources to each and every page. This would bloat traffic enormously.

TAGS
AUG Leaders

Atlassian Community Events