1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-10-24 09:38:51 +02:00
phorge-phorge/webroot/rsrc/js/application/projects/WorkboardHeader.js
epriestley 40af472ff5 Make drag-and-drop on workboards interact with priority column headers
Summary:
Ref T10333. Ref T8135. Depends on D20247. Allow users to drag-and-drop cards on a priority-sorted workboard under headers, even if the header has no other cards.

As of D20247, headers show up but they aren't really interactive. Now, you can drag cards directly underneath a header (instead of only between other cards). For example, if a column has only one "Wishlist" task, you may drag it under the "High", "Normal", or "Low" priority headers to select a specific priority.

(Some of this code still feels a little rough, but I think it will generalize once other types of sorting are available.)

Test Plan: Dragged cards within and between priority groups, saw appropriate priority edits applied in every case I could come up with.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T10333, T8135

Differential Revision: https://secure.phabricator.com/D20248
2019-03-09 10:33:26 -08:00

44 lines
895 B
JavaScript

/**
* @provides javelin-workboard-header
* @requires javelin-install
* @javelin
*/
JX.install('WorkboardHeader', {
construct: function(column, header_key) {
this._column = column;
this._headerKey = header_key;
},
members: {
_root: null,
_column: null,
_headerKey: null,
getColumn: function() {
return this._column;
},
getHeaderKey: function() {
return this._headerKey;
},
getNode: function() {
if (!this._root) {
var header_key = this.getHeaderKey();
var board = this.getColumn().getBoard();
var template = board.getHeaderTemplate(header_key).getTemplate();
this._root = JX.$H(template).getFragment().firstChild;
JX.Stratcom.getData(this._root).headerKey = header_key;
}
return this._root;
},
isWorkboardHeader: function() {
return true;
}
}
});