I have a web-item in the top navigation bar which in an icon. It displays fine, except when I am in an administration page. What am I doing wrong?
Atlassian-plugin.xml
<web-item key="my_item" section="system.top.navigation.bar" weight="99999">
<link linkId="my_item_link">/secure/Something!WebWork.jspa</link>
<styleClass>aui-button aui-button-primary</styleClass>
<label></label>
<tooltip key="item.tooltip"></tooltip>
<dependency>${project.groupId}.${project.artifactId}:my-item-resources</dependency>
</web-item>
<web-resource key="my-item-resources" name="my-item-resources">
<dependency>${atlassian.plugin.key}:common-resources</dependency>
<transformation extension="js">
<transformer key="jsI18n"/>
</transformation>
<resource type="download" name="my-item.js" location="/js/my-item.js" />
<context>my-item</context>
</web-resource>
<web-resource key="common-resources" name="Common Web Resources">
<dependency>com.atlassian.auiplugin:aui</dependency>
<dependency>com.atlassian.auiplugin:aui-experimental</dependency>
<dependency>com.atlassian.auiplugin:aui-table-sortable</dependency>
<transformation extension="js">
<transformer key="jsI18n"/>
</transformation>
<resource type="download" name="images/" location="/images" />
<resource type="download" name="my-item.css" location="/css/my-item.css"/>
<resource type="download" name="my-item.png" location="/images/my-item.png">
<param name="content-type" value="image/png"/>
</resource>
<context>atl.general</context>
<context>atl.admin</context>
<context>common</context>
<context>my-item<context>
</web-resource>
my-item.css
#my_item_link {
background-image: url(“my-item.png”);
background-repeat: no-repeat;
background-size: 16px 16px;
background-position: 0px 16px;
background-color: transparent;
border-color: transparent
}
Hi @mathieu.yargeau,
I do not see any glaring errors on your snippets. I tried it in Jira Server v7.7.1 and was able to successfully load the icon, even in the Jira Administration pages. Is there a specific page that you are experiencing this?
Cheers,
Ian
Not in a specific page, it happens in all pages. I also have a similar icon, that I make appear using the same method, in the project navigation sidebar at the left, and that icon disappears too when I enter the project settings page.
I didn’t have any error in the browser console logs when only using the atl.general context, but when I added the atl.admin context, I get a failed to load resource 404 error for both icons.
Interesting. Here’s my plugin.xml (which I patterned from yours).
<web-item name="MyWebItem" i18n-name-key="my-web-item.name"
key="my-web-item" section="system.top.navigation.bar" weight="99999">
<description key="my-web-item.description">The MyWebItem Plugin</description>
<styleClass>aui-button aui-button-primary</styleClass>
<label>
</label>
<tooltip key="item.tooltip"></tooltip>
<link linkId="my_item_link">/secure/Something!WebWork.jspa</link>
<dependency>${project.groupId}.${project.artifactId}:my-item-resources
</dependency>
</web-item>
<web-resource key="my-item-resources" name="my-item-resources">
<dependency>${atlassian.plugin.key}:jira-web-item-resources
</dependency>
<transformation extension="js">
<transformer key="jsI18n" />
</transformation>
<resource type="download" name="my-item.js" location="/js/jira-web-item.js" />
<context>jira-web-item</context>
</web-resource>
<web-resource key="jira-web-item-resources" name="jira-web-item Web Resources">
<dependency>com.atlassian.auiplugin:aui</dependency>
<dependency>com.atlassian.auiplugin:aui-experimental</dependency>
<dependency>com.atlassian.auiplugin:aui-table-sortable</dependency>
<resource type="download" name="jira-web-item.css" location="/css/jira-web-item.css" />
<resource type="download" name="images/" location="/images" />
<resource type="download" name="pluginIcon.png" location="/images/pluginIcon.png">
<param name="content-type" value="image/png" />
</resource>
<context>atl.general</context>
<context>atl.admin</context>
<context>common</context>
<context>jira-web-item</context>
</web-resource>
Here’s what it looks like in one of the administration pages
I also used the auto-generated pluginIcon.png and pluginLogo.png that resides in main/resources/images. Just to cover all the bases when checking this, what Jira version are you working with?
It’s possible that I had a conflict with another web-resource. I noticed I had a web-resource names “icon resources” and it was downloading those files too. I deleted it and it works now.