mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-28 08:20:57 +01:00
Workboards - fix adding new tasks and sorting
Summary: At least on my install, sorting was pretty borked from a type issue. (e.g. "unbreak now" of 100 sorting as less than "High" of 90). Fix this with some parseInt action. Also support adding new cards with the new colsort stuff. The clever bit here is to include the task ID in the sorting vector because the task ID wins ties at the moment I think / new tasks need to show up before older tasks when they are initially created. Fixes T5716. Test Plan: added many "normal" priority cards and saw them fly in correctly. changed priority and moved correctly. made no edits and no moves were made correctly. Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T5716 Differential Revision: https://secure.phabricator.com/D10081
This commit is contained in:
parent
a03e3683e6
commit
90431fd101
2 changed files with 15 additions and 6 deletions
|
@ -159,6 +159,7 @@ final class ManiphestTask extends ManiphestDAO
|
|||
return array(
|
||||
$this->getPriority(),
|
||||
-$this->getSubpriority(),
|
||||
$this->getID(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue