Last active
October 14, 2015 00:37
-
-
Save nterray/4280449 to your computer and use it in GitHub Desktop.
This greasemonkey script enhances the Tuleap Agile Dashboard by stacking cards in the «Done» column of the cardwall. Click on the cell and the cards become unstacked.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name stack done cards | |
// @namespace tuleap | |
// @description Automatically stacks cards which are on the column «done» of the cardwall (Tuleap Agile Dashboard) | |
// @include https://tuleap.net/plugins/agiledashboard/* | |
// @version 1 | |
// @require http://tuleap.net/scripts/prototype/prototype.js | |
// @grant none | |
// ==/UserScript== | |
var columns_to_stack = ['Done', 'Functional Review', 'Code Review'] | |
function addCss(cssString) { | |
var head = document.getElementsByTagName('head')[0]; | |
var newCss = document.createElement('style'); | |
newCss.type = "text/css"; | |
newCss.innerHTML = cssString; | |
head.appendChild(newCss); | |
} | |
addCss (' \ | |
.cardwall_stacked { \ | |
overflow: hidden; \ | |
padding-bottom: 1em; \ | |
} \ | |
.cardwall_stacked > ul { \ | |
background: red; \ | |
position: relative; \ | |
} \ | |
.cardwall_stacked > ul > .cardwall_board_postit { \ | |
position: absolute !important; \ | |
top: 10px; \ | |
} \ | |
.cardwall_stacked > ul > .cardwall_board_postit:nth-child(1) { \ | |
top: 0px; \ | |
transform:rotate(-0.5deg); \ | |
} \ | |
.cardwall_stacked > ul > .cardwall_board_postit:nth-child(2) { \ | |
top: 5px; \ | |
transform:rotate(0.5deg); \ | |
}'); | |
var columns_to_stack_index = $$('.cardwall_board th').collect(function (th) { | |
if (columns_to_stack.find(function (one) one == th.textContent)) { | |
return th.cellIndex | |
} | |
}).compact() | |
$$('.cardwall > tr > td').each(function (td) { | |
// each cell can be stacked when we click on it | |
td.observe('click', function (evt) { | |
if (Event.element(evt) == td) { | |
td.toggleClassName('cardwall_stacked') | |
} | |
}) | |
// stack cards | |
if (columns_to_stack_index.find(function (index) index == td.cellIndex)) { | |
td.addClassName('cardwall_stacked') | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment