Today I’ve been making a simple plugin for Jira, to allow drag and drop reordering of subtasks. As standard, a list of subtasks comes with links to move the items one position up or down – tedious if you want to move a long way!
Getting up and running with the Atlassian plugin SDK is really straightforward.
The plugin contains only a web-resource with the JavaScript I want to run. I’m not particularly familiar with jQuery, so it may be a little hacky or non-optimal, but it works!
A couple of useful things I learnt:
Jira provides some very specific contexts to determine which pages will include the resource. In my case, the web-resource definition in my atlassian-plugin.xml contains the line:
<context>jira.view.issue</context>
You can see all the web-resource contexts here: Web Resource plugin module contexts.
Because the list of subtasks could contain issues hidden to the current user, I parsed the new position for the sub task from the links which already exist for moving the subtasks up and down, rather than just using the row index.
You can see the source here: https://github.com/anorakgirl/subtask-dragger
Or you can download a jar here: subtask-dragger-0.1.jar. DISCLAIMER: This is just a demo, use at your own risk!
Hi,
In my company we were using Jira 5.2, and I’ve added a simple AJAX script to allow drag and drop of subtasks. But when we updated to Jira 6.0.3, this script didn’t work anymore.
Then I found your plugin, installed it and drag and drop is working again!
Thank you!
Thanks! This is working for me in Jira 6.2, a real timesaver.