Page tree

This documentation relates to an older version 2.10 of the Structure Plugin for JIRA. View the current documentation home.

Skip to end of metadata
Go to start of metadata

To include a web resource (such as custom CSS or JavaScript file) on the page every time Structure Widget is displayed, add a structure-widget-extension module to your plugin.

Use cases:

  1. 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.
  2. 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.

Widget Extensions

Structure 2.5 introduces a new module type – structure-widget-extension. Widget extensions contain references to the web resource modules that will be included on all pages where the Structure widget is present. Creating a widget extension is the preferred method of adding JavaScript and CSS code to the Structure widget since Structure 2.5.

Sample snippet from atlassian-plugin.xml:

<structure-widget-extension key="we-sbcolumn" name="widget-extension:Status Bar Column">
  <web-resource>com.almworks.jira.structure.sbcolumn:wr-sbcolumn</web-resource>
</structure-widget-extension>

structure.widget Web Resource Context

Before Structure 2.5, the only way to add JavaScript or CSS to the Structure widget was to add 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 notable exceptions are the Structure Gadget and the JIRA Agile (GreenHopper) Structure panel.

In Structure 2.5+ the structure.widget resource context is still present, but its resources are loaded only for the Structure Board and the Structure Gadget. We recommend you to use widget extensions instead.

Sample snippet from atlassian-plugin.xml:

<web-resource key="custom-field-resource" name="My Custom Field Web Resource">
  <context>structure.widget</context>
  <resource type="download" name="custom-field-resource.js" location="js/myplugin/custom-field-resource.js"/>
</web-resource>

structure.printable Web Resource Context

Web resources from the structure.printable context are loaded on the printable page. While this context is not directly associated with the Structure widget, you'll need it to add a new column type that uses custom CSS in its printable representation.

  • No labels