Skip to content

Instantly share code, notes, and snippets.

@colinbowern
Last active November 21, 2019 14:43
Show Gist options
  • Save colinbowern/5b54fb55866f3b57facffc1c6ecf109f to your computer and use it in GitHub Desktop.
Save colinbowern/5b54fb55866f3b57facffc1c6ecf109f to your computer and use it in GitHub Desktop.
Adds a drag-and-drop issue ranking handle to the JIRA epic detail issue list.
// ==UserScript==
// @name JIRA Epic Issue Ranking
// @namespace https://www.gentrack.com/
// @version 1001.0.0
// @description Adds a drag-and-drop issue ranking handle to the JIRA epic detail issue list.
// @author Colin Bowern
// @match https://*.atlassian.net/browse/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
$(window).load(function(){
if($('#ghx-issues-in-epic-table .handle').length === 0) {
$('#ghx-issues-in-epic-table tr').prepend('<td class="nav handle" style="cursor:move"><span class="aui-icon aui-icon-small aui-iconfont-appswitcher">Reorder issues</span></td>');
$('#ghx-issues-in-epic-table').sortable({
cursor: 'move',
handle: '.handle',
items: '.issuerow',
update: function(event, ui) {
console.log('Putting ' + ui.item.data('issuekey') + ' before ' + ui.item.next().data('issuekey'));
$.ajax({
url: '/rest/agile/1.0/issue/rank',
type: 'PUT',
contentType: 'application/json',
dataType: 'application/json',
data: '{ "issues":["' + ui.item.data('issuekey') + '"],"rankBeforeIssue":"' + ui.item.next().data('issuekey') + '"}'
});
}
});
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment