mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Hotfix more sortable elements
This commit is contained in:
parent
43d86d7d5d
commit
616dade81c
6 changed files with 21 additions and 22 deletions
|
@ -75,9 +75,7 @@ BlazeComponent.extendComponent({
|
||||||
});
|
});
|
||||||
|
|
||||||
// ugly touch event hotfix
|
// ugly touch event hotfix
|
||||||
$('.js-swimlane:not(.placeholder)').each(function() {
|
enableClickOnTouch('.js-swimlane:not(.placeholder)');
|
||||||
enableClickOnTouch(this);
|
|
||||||
});
|
|
||||||
|
|
||||||
function userIsMember() {
|
function userIsMember() {
|
||||||
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
|
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
|
||||||
|
|
|
@ -132,6 +132,9 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ugly touch event hotfix
|
||||||
|
enableClickOnTouch('.card-checklist-items .js-checklist');
|
||||||
|
|
||||||
const $subtasksDom = this.$('.card-subtasks-items');
|
const $subtasksDom = this.$('.card-subtasks-items');
|
||||||
|
|
||||||
$subtasksDom.sortable({
|
$subtasksDom.sortable({
|
||||||
|
@ -167,6 +170,9 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ugly touch event hotfix
|
||||||
|
enableClickOnTouch('.card-subtasks-items .js-subtasks');
|
||||||
|
|
||||||
function userIsMember() {
|
function userIsMember() {
|
||||||
return Meteor.user() && Meteor.user().isBoardMember();
|
return Meteor.user() && Meteor.user().isBoardMember();
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,7 @@ function initSorting(items) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// ugly touch event hotfix
|
// ugly touch event hotfix
|
||||||
$('.js-checklist-item:not(.placeholder)').each(function() {
|
enableClickOnTouch('.js-checklist-item:not(.placeholder)');
|
||||||
enableClickOnTouch(this);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
|
|
|
@ -84,9 +84,7 @@ BlazeComponent.extendComponent({
|
||||||
});
|
});
|
||||||
|
|
||||||
// ugly touch event hotfix
|
// ugly touch event hotfix
|
||||||
$(itemsSelector).each(function() {
|
enableClickOnTouch(itemsSelector);
|
||||||
enableClickOnTouch(this);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Disable drag-dropping if the current user is not a board member or is comment only
|
// Disable drag-dropping if the current user is not a board member or is comment only
|
||||||
this.autorun(() => {
|
this.autorun(() => {
|
||||||
|
|
|
@ -67,9 +67,7 @@ function initSortable(boardComponent, $listsDom) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// ugly touch event hotfix
|
// ugly touch event hotfix
|
||||||
$('.js-list:not(.js-list-composer)').each(function() {
|
enableClickOnTouch('.js-list:not(.js-list-composer)');
|
||||||
enableClickOnTouch(this);
|
|
||||||
});
|
|
||||||
|
|
||||||
function userIsMember() {
|
function userIsMember() {
|
||||||
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
|
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
|
||||||
|
|
|
@ -123,23 +123,24 @@ Utils = {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
enableClickOnTouch(element) {
|
enableClickOnTouch(selector) {
|
||||||
let touchStart = null;
|
let touchStart = null;
|
||||||
let lastTouch = null;
|
let lastTouch = null;
|
||||||
element.addEventListener('touchstart', function(e) {
|
|
||||||
touchStart = e.touches[0];
|
$(document).on('touchstart', selector, function(e) {
|
||||||
}, false);
|
touchStart = e.originalEvent.touches[0];
|
||||||
element.addEventListener('touchmove', function(e) {
|
});
|
||||||
const touches = e.touches;
|
$(document).on('touchmove', selector, function(e) {
|
||||||
|
const touches = e.originalEvent.touches;
|
||||||
lastTouch = touches[touches.length - 1];
|
lastTouch = touches[touches.length - 1];
|
||||||
}, true);
|
});
|
||||||
element.addEventListener('touchend', function() {
|
$(document).on('touchend', selector, function(e) {
|
||||||
if (touchStart && lastTouch && Utils.calculateTouchDistance(touchStart, lastTouch) <= 20) {
|
if (touchStart && lastTouch && Utils.calculateTouchDistance(touchStart, lastTouch) <= 20) {
|
||||||
const clickEvent = document.createEvent('MouseEvents');
|
const clickEvent = document.createEvent('MouseEvents');
|
||||||
clickEvent.initEvent('click', true, true);
|
clickEvent.initEvent('click', true, true);
|
||||||
this.dispatchEvent(clickEvent);
|
e.target.dispatchEvent(clickEvent);
|
||||||
}
|
}
|
||||||
}, false);
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue