mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Improve the multi-selection experience
New features: - select all filtered cards - assign or unassign a member to selected cards - archive selected cards This commit also fix the card sort indexes calculation when a multi- selection is drag-dropped.
This commit is contained in:
parent
a41e07b37e
commit
5478fc93db
12 changed files with 146 additions and 53 deletions
|
|
@ -37,23 +37,26 @@ Utils = {
|
|||
},
|
||||
|
||||
// Determine the new sort index
|
||||
getSortIndex: function(prevCardDomElement, nextCardDomElement) {
|
||||
calculateIndex: function(prevCardDomElement, nextCardDomElement, nCards) {
|
||||
nCards = nCards || 1;
|
||||
|
||||
// If we drop the card to an empty column
|
||||
if (! prevCardDomElement && ! nextCardDomElement) {
|
||||
return 0;
|
||||
return {base: 0, increment: 1};
|
||||
// If we drop the card in the first position
|
||||
} else if (! prevCardDomElement) {
|
||||
return Blaze.getData(nextCardDomElement).sort - 1;
|
||||
return {base: Blaze.getData(nextCardDomElement).sort - 1, increment: -1};
|
||||
// If we drop the card in the last position
|
||||
} else if (! nextCardDomElement) {
|
||||
return Blaze.getData(prevCardDomElement).sort + 1;
|
||||
return {base: Blaze.getData(prevCardDomElement).sort + 1, increment: 1};
|
||||
}
|
||||
// In the general case take the average of the previous and next element
|
||||
// sort indexes.
|
||||
else {
|
||||
var prevSortIndex = Blaze.getData(prevCardDomElement).sort;
|
||||
var nextSortIndex = Blaze.getData(nextCardDomElement).sort;
|
||||
return (prevSortIndex + nextSortIndex) / 2;
|
||||
var increment = (nextSortIndex - prevSortIndex) / (nCards + 1);
|
||||
return {base: prevSortIndex + increment, increment: increment};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue