Be aware that these JIRA 5.0+ modifications will continue to work in the form/page versions of these dialog boxes in earlier versions of JIRA.
How to Update your Plugin
There are two things custom field types need to consider to upgrade to 5.0:
- Custom field types that want to include web resources should include their web resources in the
atl.generalcontexts. Doing so will result in a plugin that works in 5.0+ and will also work in 4.2+.
JIRA.Events.NEW_CONTENT_ADDEDas well as page-load to do this work. This event is new in JIRA 5.0.
JIRA.Events.NEW_CONTENT_ADDEDis simply use a jQuery live or delegate event. JIRA 4.4+ shipped with jQuery 1.5.2+, which supports the delegate() event. JIRA 4.2+ shipped with jQuery 1.4.2+ which supports live().
For example, a plugin might have had a custom field type like this.
To fix this plugin, the call to
requireResource() should be removed, and the
<web-resource> should be included in the
JIRA.Events.NEW_CONTENT_ADDED event (added in JIRA 5.0):
Reason for change
requireResource() this is no longer supported in the
"edit" velocity of custom fields: In the Create Issue and Edit Issue dialog boxes, the edithtml is parcelled into a JSON payload via an AJAX request, and displayed dynamically on a page that already has all its web resource loaded. There is no opportunity for this AJAX request to add further JS to the page.
In the future
In JIRA 5.1, calling
requireResource() will not be supported for the other views of a custom field, either. Plugin authors are encouraged to put such web resoruces in the
atl.general context instead of calling
requireResource() from their velocity.
In future versions of JIRA, it is likely that calling
requireResource() from the velocity templates of certain web items and web-panels locations may also be deprecated/unsupported, and plugin developers are encouraged to include such web resources in the appropriate contexts, instead.