From 7ef8da82590acecca1933800c0f5e469869dcd7c Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Tue, 12 May 2015 11:37:55 -0700 Subject: [PATCH] Conpherence + workboards - fix dragging behavior breaking on subsequent page loads Summary: Fixes T8155. The former "init_board()" function was aptly named as it needs to be called each time a new board dom piece is downloaded. Ergo, break out a setup() function and call that in the once-only setup place, and use init_board() there as well as when we have a quicksand redraw event with data from the server. Test Plan: paged about a project and was able to keep dragging and dropping tasks on various loads of the board. verified drops saved correctly from load to load. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8155 Differential Revision: https://secure.phabricator.com/D12798 --- resources/celerity/map.php | 22 +++++++++---------- .../projects/behavior-project-boards.js | 9 +++++++- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 642c17dea8..c20eeda15f 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -407,7 +407,7 @@ return array( 'rsrc/js/application/policy/behavior-policy-control.js' => '9a340b3d', 'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '5e9f347c', 'rsrc/js/application/ponder/behavior-votebox.js' => '4e9b766b', - 'rsrc/js/application/projects/behavior-project-boards.js' => '60292820', + 'rsrc/js/application/projects/behavior-project-boards.js' => 'ba4fa35c', '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', @@ -637,7 +637,7 @@ return array( 'javelin-behavior-policy-control' => '9a340b3d', 'javelin-behavior-policy-rule-editor' => '5e9f347c', 'javelin-behavior-ponder-votebox' => '4e9b766b', - 'javelin-behavior-project-boards' => '60292820', + 'javelin-behavior-project-boards' => 'ba4fa35c', 'javelin-behavior-project-create' => '065227cc', 'javelin-behavior-quicksand-blacklist' => '7927a7d3', 'javelin-behavior-refresh-csrf' => '7814b593', @@ -1247,15 +1247,6 @@ return array( 'javelin-workflow', 'javelin-stratcom', ), - 60292820 => array( - 'javelin-behavior', - 'javelin-dom', - 'javelin-util', - 'javelin-vector', - 'javelin-stratcom', - 'javelin-workflow', - 'phabricator-draggable-list', - ), 60479091 => array( 'phabricator-busy', 'javelin-behavior', @@ -1729,6 +1720,15 @@ return array( 'javelin-dom', 'javelin-util', ), + 'ba4fa35c' => array( + 'javelin-behavior', + 'javelin-dom', + 'javelin-util', + 'javelin-vector', + 'javelin-stratcom', + 'javelin-workflow', + 'phabricator-draggable-list', + ), 'bba9eedf' => array( 'javelin-behavior', 'javelin-stratcom', diff --git a/webroot/rsrc/js/application/projects/behavior-project-boards.js b/webroot/rsrc/js/application/projects/behavior-project-boards.js index 20a78d0963..04e99fde28 100644 --- a/webroot/rsrc/js/application/projects/behavior-project-boards.js +++ b/webroot/rsrc/js/application/projects/behavior-project-boards.js @@ -249,6 +249,9 @@ JX.behavior('project-boards', function(config, statics) { for (ii = 0; ii < lists.length; ii++) { lists[ii].setGroup(lists); } + } + + function setup() { JX.Stratcom.listen( 'click', @@ -336,6 +339,9 @@ JX.behavior('project-boards', function(config, statics) { statics.boardID = new_config.boardID; } update_statics(new_config); + if (data.fromServer) { + init_board(); + } }); return true; } @@ -345,7 +351,8 @@ JX.behavior('project-boards', function(config, statics) { var current_page_id = JX.Quicksand.getCurrentPageID(); statics.boardConfigCache = {}; statics.boardConfigCache[current_page_id] = config; - statics.setup = init_board(); + init_board(); + statics.setup = setup(); } });