Loading Additional Web Resources For Structure Widget
To include a web resource (such as custom CSS or JavaScript file) on the page every time Structure Widget is displayed, use structure.widget
web resource context and possibly a few others.
Use cases:
You create your own custom field and would like it to be editable in the Structure grid. The field is powered by additional JavaScript or CSS, which should be loaded on the page that displays structure.
You create your own column type. You'll need to use the Structure JavaScript API and register the web resource with your JavaScript code as a widget extension.
Using Web Resource Contexts
You can add JavaScript or CSS to the Structure widget by adding a web resource to the structure.widget
context. Note, however, that due to Atlassian API limitations, context-provided web resources may not be loaded on all pages with the Structure widget. The following table lists all web resource contexts related to pages where Structure Widget can possibly be shown.
Web Resource Context | Used on... |
---|---|
| Structure Board, Structure Gadget |
| Issue Page, Issue Navigator in details view |
| Scrum and Kanban boards from JIRA Software |
| Project page (including Structure tab) |
| Printable Structure page |
To have your code present on every page where a Structure widget can possibly be shown, include all these resources. You usually don't need to include structure.printable
though, unless you have some special rules for printing.
Sample snippet from atlassian-plugin.xml
:
<web-resource key="custom-field-resource" name="My Custom Field Web Resource">
<resource type="download" name="custom-field-resource.js" location="js/myplugin/custom-field-resource.js"/>
<context>structure.widget</context>
<context>jira.view.issue</context>
<context>gh-rapid</context>
<context>jira.browse.project</context>
</web-resource>