1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 17:02:41 +01:00
phorge-phorge/webroot/rsrc/js/application/projects/behavior-project-boards.js
epriestley 826914e990 Allow tasks to be dragged-and-dropped between workboard columns (UI only)
Summary:
Ref T1344. Allows you to drag tasks within a column and between columns, and handles all the multi-column state / targeting / ghosting stuff.

This is a UI-only change; you can't actually do anything meaningful with these yet.

Roughly, I added the idea of a DraggableList existing within a "group" of draggable lists. Normally, that group only has one item, but on boards it has all of the columns. Then I made all of the relevant operations just apply to the whole group of lists.

Test Plan:
  - Verified existing funtionality in Maniphest and ApplicationSearch is unaffected, by dragging around tasks to reprioritize them and dragging around search items.
  - Dragged tasks between columns on a board view.

{F101196}

Reviewers: chad, btrahan

Reviewed By: btrahan

CC: chad, aran

Maniphest Tasks: T1344

Differential Revision: https://secure.phabricator.com/D7941
2014-01-13 12:23:57 -08:00

29 lines
686 B
JavaScript

/**
* @provides javelin-behavior-project-boards
* @requires javelin-behavior
* javelin-dom
* javelin-util
* phabricator-draggable-list
*/
JX.behavior('project-boards', function(config) {
function finditems(col) {
return JX.DOM.scry(col, 'li', 'project-card');
}
var lists = [];
var ii;
var cols = JX.DOM.scry(JX.$(config.boardID), 'ul', 'project-column');
for (ii = 0; ii < cols.length; ii++) {
var list = new JX.DraggableList('project-card', cols[ii])
.setFindItemsHandler(JX.bind(null, finditems, cols[ii]));
lists.push(list);
}
for (ii = 0; ii < lists.length; ii++) {
lists[ii].setGroup(lists);
}
});