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
77 lines
1.4 KiB
JavaScript
77 lines
1.4 KiB
JavaScript
/**
|
|
* @provides javelin-workboard-card
|
|
* @requires javelin-install
|
|
* @javelin
|
|
*/
|
|
|
|
JX.install('WorkboardCard', {
|
|
|
|
construct: function(column, phid) {
|
|
this._column = column;
|
|
this._phid = phid;
|
|
},
|
|
|
|
members: {
|
|
_column: null,
|
|
_phid: null,
|
|
_root: null,
|
|
|
|
getPHID: function() {
|
|
return this._phid;
|
|
},
|
|
|
|
getColumn: function() {
|
|
return this._column;
|
|
},
|
|
|
|
setColumn: function(column) {
|
|
this._column = column;
|
|
},
|
|
|
|
getProperties: function() {
|
|
return this.getColumn().getBoard().getObjectProperties(this.getPHID());
|
|
},
|
|
|
|
getPoints: function() {
|
|
return this.getProperties().points;
|
|
},
|
|
|
|
getStatus: function() {
|
|
return this.getProperties().status;
|
|
},
|
|
|
|
getPriority: function(order) {
|
|
return this.getProperties().priority;
|
|
},
|
|
|
|
getNode: function() {
|
|
if (!this._root) {
|
|
var phid = this.getPHID();
|
|
var template = this.getColumn().getBoard().getCardTemplate(phid);
|
|
this._root = JX.$H(template).getFragment().firstChild;
|
|
|
|
JX.Stratcom.getData(this._root).objectPHID = this.getPHID();
|
|
}
|
|
return this._root;
|
|
},
|
|
|
|
isWorkboardHeader: function() {
|
|
return false;
|
|
},
|
|
|
|
redraw: function() {
|
|
var old_node = this._root;
|
|
this._root = null;
|
|
var new_node = this.getNode();
|
|
|
|
if (old_node && old_node.parentNode) {
|
|
JX.DOM.replace(old_node, new_node);
|
|
}
|
|
|
|
return this;
|
|
}
|
|
|
|
}
|
|
|
|
});
|