Page MenuHomePhabricator

D15228.id36752.diff
No OneTemporary

D15228.id36752.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -415,8 +415,8 @@
'rsrc/js/application/phortune/phortune-credit-card-form.js' => '2290aeef',
'rsrc/js/application/policy/behavior-policy-control.js' => 'd0c516d5',
'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '5e9f347c',
- 'rsrc/js/application/projects/Workboard.js' => 'fa8ab410',
- 'rsrc/js/application/projects/behavior-project-boards.js' => '7784bfc6',
+ 'rsrc/js/application/projects/Workboard.js' => '088b2495',
+ 'rsrc/js/application/projects/behavior-project-boards.js' => '37eb99e4',
'rsrc/js/application/projects/behavior-project-create.js' => '065227cc',
'rsrc/js/application/projects/behavior-reorder-columns.js' => 'e1d25dfb',
'rsrc/js/application/releeph/releeph-preview-branch.js' => 'b2b4fbaf',
@@ -656,7 +656,7 @@
'javelin-behavior-phui-profile-menu' => '12884df9',
'javelin-behavior-policy-control' => 'd0c516d5',
'javelin-behavior-policy-rule-editor' => '5e9f347c',
- 'javelin-behavior-project-boards' => '7784bfc6',
+ 'javelin-behavior-project-boards' => '37eb99e4',
'javelin-behavior-project-create' => '065227cc',
'javelin-behavior-quicksand-blacklist' => '7927a7d3',
'javelin-behavior-recurring-edit' => '5f1c4d5f',
@@ -723,7 +723,7 @@
'javelin-view-renderer' => '6c2b09a2',
'javelin-view-visitor' => 'efe49472',
'javelin-websocket' => 'e292eaf4',
- 'javelin-workboard' => 'fa8ab410',
+ 'javelin-workboard' => '088b2495',
'javelin-workflow' => '5b2e3e2b',
'lightbox-attachment-css' => '7acac05d',
'maniphest-batch-editor' => 'b0f0b6d5',
@@ -930,6 +930,16 @@
'javelin-stratcom',
'javelin-vector',
),
+ '088b2495' => array(
+ 'javelin-install',
+ 'javelin-dom',
+ 'javelin-util',
+ 'javelin-vector',
+ 'javelin-stratcom',
+ 'javelin-workflow',
+ 'phabricator-draggable-list',
+ 'phabricator-drag-and-drop-file-upload',
+ ),
'0a3f3021' => array(
'javelin-behavior',
'javelin-stratcom',
@@ -1086,6 +1096,17 @@
'javelin-vector',
'phuix-autocomplete',
),
+ '37eb99e4' => array(
+ 'javelin-behavior',
+ 'javelin-dom',
+ 'javelin-util',
+ 'javelin-vector',
+ 'javelin-stratcom',
+ 'javelin-workflow',
+ 'phabricator-draggable-list',
+ 'phabricator-drag-and-drop-file-upload',
+ 'javelin-workboard',
+ ),
'3ab51e2c' => array(
'javelin-behavior',
'javelin-behavior-device',
@@ -1407,17 +1428,6 @@
'javelin-reactor',
'javelin-util',
),
- '7784bfc6' => array(
- 'javelin-behavior',
- 'javelin-dom',
- 'javelin-util',
- 'javelin-vector',
- 'javelin-stratcom',
- 'javelin-workflow',
- 'phabricator-draggable-list',
- 'phabricator-drag-and-drop-file-upload',
- 'javelin-workboard',
- ),
'782ab6e7' => array(
'javelin-behavior',
'javelin-dom',
@@ -2078,16 +2088,6 @@
'javelin-vector',
'javelin-magical-init',
),
- 'fa8ab410' => array(
- 'javelin-install',
- 'javelin-dom',
- 'javelin-util',
- 'javelin-vector',
- 'javelin-stratcom',
- 'javelin-workflow',
- 'phabricator-draggable-list',
- 'phabricator-drag-and-drop-file-upload',
- ),
'fb20ac8d' => array(
'javelin-behavior',
'javelin-aphlict',
diff --git a/src/applications/project/controller/PhabricatorProjectController.php b/src/applications/project/controller/PhabricatorProjectController.php
--- a/src/applications/project/controller/PhabricatorProjectController.php
+++ b/src/applications/project/controller/PhabricatorProjectController.php
@@ -192,7 +192,8 @@
return id(new AphrontAjaxResponse())
->setContent(
array(
- 'task' => $item,
+ 'objectPHID' => $object->getPHID(),
+ 'cardHTML' => $item,
));
}
diff --git a/webroot/rsrc/js/application/projects/Workboard.js b/webroot/rsrc/js/application/projects/Workboard.js
--- a/webroot/rsrc/js/application/projects/Workboard.js
+++ b/webroot/rsrc/js/application/projects/Workboard.js
@@ -17,9 +17,14 @@
this._config = config;
this._boardNodes = {};
+ this._columnMap = {};
+ },
- this._setupCoverImageHandlers();
- this._setupPanHandlers();
+ properties: {
+ uploadURI: null,
+ coverURI: null,
+ moveURI: null,
+ chunkThreshold: null
},
members: {
@@ -31,13 +36,19 @@
_panNode: null,
_panX: null,
+ _columnMap: null,
+
+ start: function() {
+ this._setupCoverImageHandlers();
+ this._setupPanHandlers();
+
+ return this;
+ },
+
addBoard: function(board_phid, board_node) {
this._currentBoard = board_phid;
-
- if (!this._boardNodes[board_phid]) {
- this._boardNodes[board_phid] = board_node;
- this._setupDragHandlers(board_node);
- }
+ this._boardNodes[board_phid] = board_node;
+ this._setupDragHandlers(board_node);
},
_getConfig: function() {
@@ -49,11 +60,9 @@
return;
}
- var config = this._getConfig();
-
var drop = new JX.PhabricatorDragAndDropFileUpload('project-card')
- .setURI(config.uploadURI)
- .setChunkThreshold(config.chunkThreshold);
+ .setURI(this.getUploadURI())
+ .setChunkThreshold(this.getChunkThreshold());
drop.listen('didBeginDrag', function(node) {
JX.DOM.alterClass(node, 'phui-workcard-upload-target', true);
@@ -63,25 +72,24 @@
JX.DOM.alterClass(node, 'phui-workcard-upload-target', false);
});
- drop.listen('didUpload', function(file) {
- var node = file.getTargetNode();
+ drop.listen('didUpload', JX.bind(this, this._oncoverupload));
- var board = JX.DOM.findAbove(node, 'div', 'jx-workboard');
+ drop.start();
+ },
- var data = {
- boardPHID: JX.Stratcom.getData(board).boardPHID,
- objectPHID: JX.Stratcom.getData(node).objectPHID,
- filePHID: file.getPHID()
- };
+ _oncoverupload: function(file) {
+ var node = file.getTargetNode();
+ var board = JX.DOM.findAbove(node, 'div', 'jx-workboard');
- new JX.Workflow(config.coverURI, data)
- .setHandler(function(r) {
- JX.DOM.replace(node, JX.$H(r.task));
- })
- .start();
- });
+ var data = {
+ boardPHID: JX.Stratcom.getData(board).boardPHID,
+ objectPHID: JX.Stratcom.getData(node).objectPHID,
+ filePHID: file.getPHID()
+ };
- drop.start();
+ new JX.Workflow(this.getCoverURI(), data)
+ .setHandler(JX.bind(this, this._queueCardUpdate))
+ .start();
},
_setupPanHandlers: function() {
@@ -192,7 +200,7 @@
var config = this._getConfig();
data.order = config.order;
- new JX.Workflow(config.moveURI, data)
+ new JX.Workflow(this.getMoveURI(), data)
.setHandler(JX.bind(this, this._oncardupdate, item, list))
.start();
},
@@ -200,7 +208,33 @@
_oncardupdate: function(item, list, response) {
list.unlock();
JX.DOM.alterClass(item, 'drag-sending', false);
- JX.DOM.replace(item, JX.$H(response.task));
+
+ this._queueCardUpdate(response);
+ },
+
+ _queueCardUpdate: function(response) {
+ var board_node = this._boardNodes[this._currentBoard];
+
+ var columns = this._findBoardColumns(board_node);
+ var cards;
+ var ii;
+ var jj;
+ var data;
+
+ for (ii = 0; ii < columns.length; ii++) {
+ cards = this._findCardsInColumn(columns[ii]);
+ for (jj = 0; jj < cards.length; jj++) {
+ data = JX.Stratcom.getData(cards[jj]);
+ if (data.objectPHID == response.objectPHID) {
+ this._replaceCard(cards[jj], JX.$H(response.cardHTML));
+ }
+ }
+ }
+
+ },
+
+ _replaceCard: function(old_node, new_node) {
+ JX.DOM.replace(old_node, new_node);
}
}
diff --git a/webroot/rsrc/js/application/projects/behavior-project-boards.js b/webroot/rsrc/js/application/projects/behavior-project-boards.js
--- a/webroot/rsrc/js/application/projects/behavior-project-boards.js
+++ b/webroot/rsrc/js/application/projects/behavior-project-boards.js
@@ -234,7 +234,12 @@
}
if (!statics.workboard) {
- statics.workboard = new JX.Workboard(config);
+ statics.workboard = new JX.Workboard(config)
+ .setUploadURI(config.uploadURI)
+ .setCoverURI(config.coverURI)
+ .setMoveURI(config.moveURI)
+ .setChunkThreshold(config.chunkThreshold)
+ .start();
}
statics.workboard.addBoard(config.projectPHID, JX.$(config.boardID));

File Metadata

Mime Type
text/plain
Expires
Oct 18 2024, 5:43 AM (4 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6725222
Default Alt Text
D15228.id36752.diff (8 KB)

Event Timeline