Fix move parameters

This commit is contained in:
Andrés Manelli 2018-02-07 01:18:08 -03:00
parent 79ae90825e
commit fcebb2a537
2 changed files with 7 additions and 8 deletions

View file

@ -172,13 +172,13 @@ Template.cardDetailsActionsPopup.events({
'click .js-copy-card': Popup.open('copyCard'), 'click .js-copy-card': Popup.open('copyCard'),
'click .js-move-card-to-top' (evt) { 'click .js-move-card-to-top' (evt) {
evt.preventDefault(); evt.preventDefault();
const minOrder = _.min(this.list().cards().map((c) => c.sort)); const minOrder = _.min(this.list().cards(this.swimlaneId).map((c) => c.sort));
this.move(this.listId, minOrder - 1); this.move(this.swimlaneId, this.listId, minOrder - 1);
}, },
'click .js-move-card-to-bottom' (evt) { 'click .js-move-card-to-bottom' (evt) {
evt.preventDefault(); evt.preventDefault();
const maxOrder = _.max(this.list().cards().map((c) => c.sort)); const maxOrder = _.max(this.list().cards(this.swimlaneId).map((c) => c.sort));
this.move(this.listId, maxOrder + 1); this.move(this.swimlaneId, this.listId, maxOrder + 1);
}, },
'click .js-archive' (evt) { 'click .js-archive' (evt) {
evt.preventDefault(); evt.preventDefault();
@ -215,7 +215,7 @@ Template.moveCardPopup.events({
// instead from a “component” state. // instead from a “component” state.
const card = Cards.findOne(Session.get('currentCard')); const card = Cards.findOne(Session.get('currentCard'));
const newListId = this._id; const newListId = this._id;
card.move(newListId); card.move(card.swimlaneId, newListId, 0);
Popup.close(); Popup.close();
}, },
}); });

View file

@ -225,10 +225,9 @@ Cards.mutations({
swimlaneId, swimlaneId,
listId, listId,
boardId: list.boardId, boardId: list.boardId,
sort: sortIndex,
}; };
if (sortIndex) {
mutatedFields.sort = sortIndex;
}
return {$set: mutatedFields}; return {$set: mutatedFields};
}, },