diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php index 0a313a5b16..d3f30b03c0 100644 --- a/src/applications/maniphest/storage/ManiphestTask.php +++ b/src/applications/maniphest/storage/ManiphestTask.php @@ -159,6 +159,7 @@ final class ManiphestTask extends ManiphestDAO return array( $this->getPriority(), -$this->getSubpriority(), + $this->getID(), ); } diff --git a/webroot/rsrc/js/application/projects/behavior-project-boards.js b/webroot/rsrc/js/application/projects/behavior-project-boards.js index 90320c60f4..c050562878 100644 --- a/webroot/rsrc/js/application/projects/behavior-project-boards.js +++ b/webroot/rsrc/js/application/projects/behavior-project-boards.js @@ -29,10 +29,11 @@ JX.behavior('project-boards', function(config) { var vd = JX.Stratcom.getData(v).sort || []; for (var ii = 0; ii < ud.length; ii++) { - if (ud[ii] < vd[ii]) { + + if (parseInt(ud[ii]) < parseInt(vd[ii])) { return 1; } - if (ud[ii] > vd[ii]) { + if (parseInt(ud[ii]) > parseInt(vd[ii])) { return -1; } } @@ -108,10 +109,11 @@ JX.behavior('project-boards', function(config) { lists[ii].setGroup(lists); } - var onedit = function(card, column, r) { + var onedit = function(column, r) { var new_card = JX.$H(r.tasks).getNode(); var new_data = JX.Stratcom.getData(new_card); var items = finditems(column); + var edited = false; for (var ii = 0; ii < items.length; ii++) { var item = items[ii]; @@ -122,11 +124,18 @@ JX.behavior('project-boards', function(config) { if (phid == new_data.objectPHID) { items[ii] = new_card; data = new_data; + edited = true; } data.sort = r.data.sortMap[data.objectPHID] || data.sort; } + // this is an add then...! + if (!edited) { + items[items.length + 1] = new_card; + new_data.sort = r.data.sortMap[new_data.objectPHID] || new_data.sort; + } + items.sort(colsort); JX.DOM.setContent(column, items); @@ -137,13 +146,12 @@ JX.behavior('project-boards', function(config) { ['edit-project-card'], function(e) { e.kill(); - var card = e.getNode('project-card'); var column = e.getNode('project-column'); var request_data = { 'responseType' : 'card', 'columnPHID' : JX.Stratcom.getData(column).columnPHID }; new JX.Workflow(e.getNode('tag:a').href, request_data) - .setHandler(JX.bind(null, onedit, card, column)) + .setHandler(JX.bind(null, onedit, column)) .start(); }); @@ -167,7 +175,7 @@ JX.behavior('project-boards', function(config) { } } new JX.Workflow(config.createURI, request_data) - .setHandler(JX.bind(null, onedit, null, column)) + .setHandler(JX.bind(null, onedit, column)) .start(); }); });