mirror of
https://github.com/wekan/wekan.git
synced 2025-12-18 16:30:13 +01:00
commit
efb083aabf
8 changed files with 84 additions and 13 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
const subManager = new SubsManager();
|
const subManager = new SubsManager();
|
||||||
const { calculateIndex } = Utils;
|
const { calculateIndex, enableClickOnTouch } = Utils;
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
onCreated() {
|
onCreated() {
|
||||||
|
|
@ -74,6 +74,9 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ugly touch event hotfix
|
||||||
|
enableClickOnTouch('.js-swimlane:not(.placeholder)');
|
||||||
|
|
||||||
function userIsMember() {
|
function userIsMember() {
|
||||||
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
|
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
const subManager = new SubsManager();
|
const subManager = new SubsManager();
|
||||||
const { calculateIndexData } = Utils;
|
const { calculateIndexData, enableClickOnTouch } = Utils;
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
mixins() {
|
mixins() {
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const { calculateIndexData } = Utils;
|
const { calculateIndexData, enableClickOnTouch } = Utils;
|
||||||
|
|
||||||
function initSorting(items) {
|
function initSorting(items) {
|
||||||
items.sortable({
|
items.sortable({
|
||||||
|
|
@ -36,6 +36,9 @@ function initSorting(items) {
|
||||||
checklistItem.move(checklistId, sortIndex.base);
|
checklistItem.move(checklistId, sortIndex.base);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ugly touch event hotfix
|
||||||
|
enableClickOnTouch('.js-checklist-item:not(.placeholder)');
|
||||||
}
|
}
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const { calculateIndex } = Utils;
|
const { calculateIndex, enableClickOnTouch } = Utils;
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
// Proxy
|
// Proxy
|
||||||
|
|
@ -83,6 +83,9 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ugly touch event hotfix
|
||||||
|
enableClickOnTouch(itemsSelector);
|
||||||
|
|
||||||
// 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(() => {
|
||||||
$cards.sortable('option', 'disabled', !userIsMember());
|
$cards.sortable('option', 'disabled', !userIsMember());
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@
|
||||||
position: absolute
|
position: absolute
|
||||||
right: 0px
|
right: 0px
|
||||||
padding: 10px
|
padding: 10px
|
||||||
margin: -10px
|
margin: -10px 0 -10px -10px
|
||||||
|
|
||||||
.announcement,
|
.announcement,
|
||||||
.offline-warning
|
.offline-warning
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
|
const { isTouchDevice } = Utils;
|
||||||
|
|
||||||
Mixins.PerfectScrollbar = BlazeComponent.extendComponent({
|
Mixins.PerfectScrollbar = BlazeComponent.extendComponent({
|
||||||
onRendered() {
|
onRendered() {
|
||||||
|
if (!isTouchDevice()) {
|
||||||
const component = this.mixinParent();
|
const component = this.mixinParent();
|
||||||
const domElement = component.find('.js-perfect-scrollbar');
|
const domElement = component.find('.js-perfect-scrollbar');
|
||||||
Ps.initialize(domElement);
|
Ps.initialize(domElement);
|
||||||
|
|
@ -8,5 +11,6 @@ Mixins.PerfectScrollbar = BlazeComponent.extendComponent({
|
||||||
// but since BlazeComponent doesn't merge Mixins events transparently I
|
// but since BlazeComponent doesn't merge Mixins events transparently I
|
||||||
// prefered to use a jQuery event (which is what an event map ends up doing)
|
// prefered to use a jQuery event (which is what an event map ends up doing)
|
||||||
component.$(domElement).on('mouseenter', () => Ps.update(domElement));
|
component.$(domElement).on('mouseenter', () => Ps.update(domElement));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const { calculateIndex } = Utils;
|
const { calculateIndex, enableClickOnTouch } = Utils;
|
||||||
|
|
||||||
function currentCardIsInThisList(listId, swimlaneId) {
|
function currentCardIsInThisList(listId, swimlaneId) {
|
||||||
const currentCard = Cards.findOne(Session.get('currentCard'));
|
const currentCard = Cards.findOne(Session.get('currentCard'));
|
||||||
|
|
@ -66,6 +66,9 @@ function initSortable(boardComponent, $listsDom) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ugly touch event hotfix
|
||||||
|
enableClickOnTouch('.js-list:not(.js-list-composer)');
|
||||||
|
|
||||||
function userIsMember() {
|
function userIsMember() {
|
||||||
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
|
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,55 @@ Utils = {
|
||||||
increment,
|
increment,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Detect touch device
|
||||||
|
isTouchDevice() {
|
||||||
|
const isTouchable = (() => {
|
||||||
|
const prefixes = ' -webkit- -moz- -o- -ms- '.split(' ');
|
||||||
|
const mq = function(query) {
|
||||||
|
return window.matchMedia(query).matches;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// include the 'heartz' as a way to have a non matching MQ to help terminate the join
|
||||||
|
// https://git.io/vznFH
|
||||||
|
const query = ['(', prefixes.join('touch-enabled),('), 'heartz', ')'].join('');
|
||||||
|
return mq(query);
|
||||||
|
})();
|
||||||
|
Utils.isTouchDevice = () => isTouchable;
|
||||||
|
return isTouchable;
|
||||||
|
},
|
||||||
|
|
||||||
|
calculateTouchDistance(touchA, touchB) {
|
||||||
|
return Math.sqrt(
|
||||||
|
Math.pow(touchA.screenX - touchB.screenX, 2) +
|
||||||
|
Math.pow(touchA.screenY - touchB.screenY, 2)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
enableClickOnTouch(selector) {
|
||||||
|
let touchStart = null;
|
||||||
|
let lastTouch = null;
|
||||||
|
|
||||||
|
$(document).on('touchstart', selector, function(e) {
|
||||||
|
touchStart = e.originalEvent.touches[0];
|
||||||
|
});
|
||||||
|
$(document).on('touchmove', selector, function(e) {
|
||||||
|
const touches = e.originalEvent.touches;
|
||||||
|
lastTouch = touches[touches.length - 1];
|
||||||
|
});
|
||||||
|
$(document).on('touchend', selector, function(e) {
|
||||||
|
if (touchStart && lastTouch && Utils.calculateTouchDistance(touchStart, lastTouch) <= 20) {
|
||||||
|
e.preventDefault();
|
||||||
|
const clickEvent = document.createEvent('MouseEvents');
|
||||||
|
clickEvent.initEvent('click', true, true);
|
||||||
|
e.target.dispatchEvent(clickEvent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// A simple tracker dependency that we invalidate every time the window is
|
// A simple tracker dependency that we invalidate every time the window is
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue