summaryrefslogtreecommitdiffstats
path: root/client/components/lists/list.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/lists/list.js')
-rw-r--r--client/components/lists/list.js25
1 files changed, 21 insertions, 4 deletions
diff --git a/client/components/lists/list.js b/client/components/lists/list.js
index 38a87674..ea0068eb 100644
--- a/client/components/lists/list.js
+++ b/client/components/lists/list.js
@@ -1,4 +1,4 @@
-const { calculateIndex } = Utils;
+const { calculateIndex, enableClickOnTouch } = Utils;
BlazeComponent.extendComponent({
// Proxy
@@ -26,6 +26,13 @@ BlazeComponent.extendComponent({
const itemsSelector = '.js-minicard:not(.placeholder, .js-card-composer)';
const $cards = this.$('.js-minicards');
+
+ if(window.matchMedia('(max-width: 1199px)').matches) {
+ $( '.js-minicards' ).sortable({
+ handle: '.handle',
+ });
+ }
+
$cards.sortable({
connectWith: '.js-minicards:not(.js-list-full)',
tolerance: 'pointer',
@@ -47,6 +54,7 @@ BlazeComponent.extendComponent({
items: itemsSelector,
placeholder: 'minicard-wrapper placeholder',
start(evt, ui) {
+ ui.helper.css('z-index', 1000);
ui.placeholder.height(ui.helper.height());
EscapeActions.executeUpTo('popup-close');
boardComponent.setIsDragging(true);
@@ -59,7 +67,13 @@ BlazeComponent.extendComponent({
const nCards = MultiSelection.isActive() ? MultiSelection.count() : 1;
const sortIndex = calculateIndex(prevCardDom, nextCardDom, nCards);
const listId = Blaze.getData(ui.item.parents('.list').get(0))._id;
- const swimlaneId = Blaze.getData(ui.item.parents('.swimlane').get(0))._id;
+ const currentBoard = Boards.findOne(Session.get('currentBoard'));
+ let swimlaneId = '';
+ const boardView = (Meteor.user().profile || {}).boardView;
+ if (boardView === 'board-view-swimlanes' || currentBoard.isTemplatesBoard())
+ swimlaneId = Blaze.getData(ui.item.parents('.swimlane').get(0))._id;
+ else if ((boardView === 'board-view-lists') || (boardView === 'board-view-cal') || !boardView)
+ swimlaneId = currentBoard.getDefaultSwimline()._id;
// Normally the jquery-ui sortable library moves the dragged DOM element
// to its new position, which disrupts Blaze reactive updates mechanism
@@ -72,17 +86,20 @@ BlazeComponent.extendComponent({
if (MultiSelection.isActive()) {
Cards.find(MultiSelection.getMongoSelector()).forEach((card, i) => {
- card.move(swimlaneId, listId, sortIndex.base + i * sortIndex.increment);
+ card.move(currentBoard._id, swimlaneId, listId, sortIndex.base + i * sortIndex.increment);
});
} else {
const cardDomElement = ui.item.get(0);
const card = Blaze.getData(cardDomElement);
- card.move(swimlaneId, listId, sortIndex.base);
+ card.move(currentBoard._id, swimlaneId, listId, sortIndex.base);
}
boardComponent.setIsDragging(false);
},
});
+ // ugly touch event hotfix
+ enableClickOnTouch(itemsSelector);
+
// Disable drag-dropping if the current user is not a board member or is comment only
this.autorun(() => {
$cards.sortable('option', 'disabled', !userIsMember());