We had a particular itch to scratch in terms of ordering our Jira issues using MoSCoW so I spent a wee bit of time creating this bookmarklet (Order Issues (drag into your bookmark bar and click to apply)). Then click to apply the sorting on your To Do column. Dead easy ehh?
This is the code:
var container = document.querySelector(".ghx-columns").querySelectorAll(".ghx-column")[0]; var elements = container.childNodes; var sortMe = []; for (var i = 0; i < elements.length; i++) { var sortPart = -1; console.log(elements[i].querySelector(".ghx-priority").title); if(elements[i].querySelector(".ghx-priority").title === "Must"){ sortPart = 4; } if(elements[i].querySelector(".ghx-priority").title === "Should"){ sortPart = 3; } if(elements[i].querySelector(".ghx-priority").title === "Could"){ sortPart = 2; } if(elements[i].querySelector(".ghx-priority").title === "Won't"){ sortPart = 1; } sortMe.push([sortPart, elements[i]]); } console.log(sortMe); sortMe.sort(function(x, y) { return y[0] - x[0]; }); for (var i = 0; i < sortMe.length; i++) { container.appendChild(sortMe[i][1]); }
No comments:
Post a Comment