2016-02-10 14:59:46 +01:00
|
|
|
/**
|
|
|
|
* @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;
|
|
|
|
},
|
|
|
|
|
2016-02-10 22:53:36 +01:00
|
|
|
getProperties: function() {
|
Modularize workboard column orders
Summary:
Depends on D20267. Depends on D20268. Ref T10333. Currently, we support "Natural" and "Priority" orders, but a lot of the particulars are pretty hard-coded, including some logic in `ManiphestTask`.
Although it's not clear that we'll ever put other types of objects on workboards, it seems generally bad that you need to modify `ManiphestTask` to get a new ordering.
Pull the ordering logic out into a `ProjectColumnOrder` hierarchy instead, and let each ordering define the things it needs to work (name, icon, what headers look like, how different objects are sorted, and how to apply an edit when you drop an object under a header).
Then move the existing "Natural" and "Priority" orders into this new hierarchy.
This has a minor bug where using the "Edit" workflow to change a card's priority on a priority-ordered board doesn't fully refresh card/header order since the response isn't ordering-aware. I'll fix that in an upcoming change.
Test Plan: Grouped workboards by "Natural" and "Priority", dragged stuff around within and between columns, grepped for all touched symbols.
Reviewers: amckinley
Reviewed By: amckinley
Maniphest Tasks: T10333
Differential Revision: https://secure.phabricator.com/D20269
2019-03-11 05:49:12 +01:00
|
|
|
return this.getColumn().getBoard()
|
|
|
|
.getCardTemplate(this.getPHID())
|
2019-03-11 03:53:25 +01:00
|
|
|
.getObjectProperties();
|
2016-02-10 22:53:36 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
getPoints: function() {
|
|
|
|
return this.getProperties().points;
|
|
|
|
},
|
|
|
|
|
|
|
|
getStatus: function() {
|
|
|
|
return this.getProperties().status;
|
|
|
|
},
|
|
|
|
|
2016-02-10 14:59:46 +01:00
|
|
|
getNode: function() {
|
|
|
|
if (!this._root) {
|
|
|
|
var phid = this.getPHID();
|
|
|
|
|
2019-03-11 03:53:25 +01:00
|
|
|
var root = this.getColumn().getBoard()
|
|
|
|
.getCardTemplate(phid)
|
|
|
|
.newNode();
|
|
|
|
|
|
|
|
JX.Stratcom.getData(root).objectPHID = phid;
|
|
|
|
|
|
|
|
this._root = root;
|
2016-02-10 14:59:46 +01:00
|
|
|
}
|
2019-03-11 03:53:25 +01:00
|
|
|
|
2016-02-10 14:59:46 +01:00
|
|
|
return this._root;
|
|
|
|
},
|
|
|
|
|
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-05 16:38:35 +01:00
|
|
|
isWorkboardHeader: function() {
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
2016-02-10 14:59:46 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|