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.
Community moderators have prevented the ability to post new answers.
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")
You can add it to the velocity file directly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, but I already figured out how to include the resources correctly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.