JIRA sub-task order editor

Change the order of JIRA sub-tasks via drag and drop.

< Opiniones de JIRA sub-task order editor

Puntuación: Pasable; el script funciona, pero tiene carencias importantes

§
Publicado: 10/03/2016

Patch

This was not working for me in Chrome 48 on Mac OS X. In order to get it going again, I had to add the following to the UserScript block:

// @require http://code.jquery.com/jquery-2.2.1.min.js 
// @require https://code.jquery.com/ui/1.11.4/jquery-ui.min.js
§
Publicado: 10/03/2016

Okay, after doing that I wanted to see how difficult it would be to update the sequence numbers as well. As it turns out, not difficult at all. Here's the entire updated script.

// ==UserScript==
// @name       JIRA sub-task order editor
// @namespace  com.nordstrom.sets
// @version    2.0
// @description  Change the order of JIRA sub-tasks via drag and drop.
// @match      https://*/browse/*
// @copyright  2012
// @require http://code.jquery.com/jquery-2.2.1.min.js 
// @require https://code.jquery.com/ui/1.11.4/jquery-ui.min.js
// ==/UserScript==


function getorder(){
    order=[];
    $('#issuetable>tbody').children('tr').each(
        function(idx,elm) {
            if(elm.id) {
                order.push(elm.id);
            }
        });
    return order;
}

jQuery("#issuetable>tbody").sortable(
    { 
        start:function() {
            old_order=getorder();
        } ,
        stop:function(event,ui) {
            new_order=getorder();
            for(i=0;i<=new_order.length;i++) {
                id=ui.item[0].id;
                if(id==old_order[i])oldpos=i;
                if(id==new_order[i])newpos=i;
            } 
            jQuery.ajax( {url:'/jira/secure/MoveIssueLink.jspa?id='+jQuery('#key-val').attr('rel')+'&currentSubTaskSequence='+oldpos+'&subTaskSequence='+newpos,} );
            $('#issuetable>tbody .stsequence').each( function(idx, elem) { 
                $(elem).text((idx+1) + '.'); // .each() index is 0-based
            });
        }
    });

Publicar respuesta

Inicia sesión para responder.

长期地址
遇到问题?请前往 GitHub 提 Issues。