I am writing a report plugin for Jira 4.4.
<?xml version="1.0" encoding="UTF-8"?> <atlassian-plugin key="de.fact.jira.plugins.reporting" name="FACT Reporting" plugins-version="2"> <plugin-info> <description>FACT Reporting</description> <version>1.0</version> <vendor name="FACT" /> </plugin-info> <web-resource key="styles" name="FACT Reporting Styles" i18n-name-key="styles.name"> <resource type="download" name="styles.css" location="/templates/reports/styles.css" /> </web-resource> <report key="release-report" name="FACT Release Report" i18n-name-key="release-report.name" class="de.fact.jira.plugins.reports.ReleaseReport"> <label key="release-report.label" /> <description key="release-report.description" /> <resource name="view" type="velocity" location="/templates/reports/release-report/view.vm" /> <resource name="i18n" type="i18n" location="ReleaseReport" /> <properties> ... </properties> </report> <resource type="i18n" name="i18n" location="atlassian-plugin" /> </atlassian-plugin>
In my Velocity template I use the requireResource macro to include the resources into the header.
#requireResource("de.fact.jira.plugins.reporting:styles")
It does not do anything. Do I have to inlcude this macro in my template or should it work out of the box? What macros are available by default?
Community moderators have prevented the ability to post new answers.
maybe this helps:
in your atlassian-plugin.xml define your resources:
<web-resource key="sth-resources" name="sth Web Resources"> <dependency>com.atlassian.auiplugin:ajs</dependency> <resource type="download" key="sth.css" name="sth.css" location="/css/sth.css" /> <resource type="download" name="sth.js" location="/js/v.js" /> <resource type="download" name="images/" location="/images" /> <context>STH CONTEXT</context> </web-resource>
in your velocity template :
$webResourceManager.requireResourcesForContext("STH CONTEXT")
you can pass webResourceManager to template using:
params.put("webResourceManager", ComponentAccessor.getComponentOfType(WebResourceManager.class));
I have same problem and tried both way $webResourceManager.requireResourcesForContext("my-context") and
#requireResourcesForContext("my-context")
but nothing works for me. I have one css which I wants to include in my macro, I tried by both of this way but no css will be applied to macro.
myMacro.vm
#requireResourcesForContext("nc-display-confluence-log")
<h3>Atlassian Confluence Log</h3>
#if(${data.getGeneratedLog()})
<div class="log-window" >
${data.getGeneratedLog()}
</div>
#else
<h3>No Log generated yet.</h3>
#end
and atlassian-plugin.xml includes,
<web-resource key="ncDisplayConfluenceLog-resources" name="ncDisplayConfluenceLog Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<resource type="download" name="ncDisplayConfluenceLog.css"
location="/com/myCompany/confluence/ndcl/css/ncDisplayConfluenceLog.css"/>
<resource type="download" name="ncDisplayConfluenceLog.js"
location="/com/myCompany/confluence/ndcl/js/ncDisplayConfluenceLog.js"/>
<resource type="download" name="images/" location="/com/myCompany/confluence/ndcl/images"/>
<context>my-context</context>
</web-resource>
Any suggestion on it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi.
after i tested all suggestions i found that i can load my javascript and css file with this code in my velocity(vm) files.
<link type="text/css" href="$req.contextPath/download/resources/com.jira.plugins.persiandatepicker:resources/jquery-ui-1.8.14.css" rel="stylesheet" /> <script type="text/javascript" src="$req.contextPath/download/resources/com.jira.plugins.persiandatepicker:resources/jquery.ui.datepicker-cc.all.min.js"></script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Why is
requireResourcesForContext
not woking ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi. i have the same problem
<web-resource key="resources" name="Resources"> <dependency>com.atlassian.auiplugin:jquery</dependency> <resource type="download" name="jqueryuidatepicker" location="templates/com/pooya/jira/plugins/persiandatepicker/scripts/jquery.ui.datepicker-cc.all.min.js"/> <resource type="download" name="images/" location="templates/com/pooya/jira/plugins/persiandatepicker/styles/images"/> <resource type="download" name="jqueryuicss" location="templates/com/pooya/jira/plugins/persiandatepicker/styles/jquery-ui-1.8.14.css"> <property key="content-type" value="text/css"/> </resource> <context>jira.general</context> <context>atl.general</context> <context>atl.admin</context> </web-resource>
i used #requireResource and #requireResourcesForContext but both of them didn't work.
after run the project i see #requireResource(....) id create issue pop-up in dashboard
please help me how to use my javascript function in edit velocity file of my plugin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It should work out of the box - have you tried it with the #includeResources() macro to ensure they are included, so do
#requireResource("de.fact.jira.plugins.reporting:styles") #includeResources()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.