Merge pull request #3045 from marc1006/mobile_followup

Follow-up for https://github.com/wekan/wekan/pull/3040
This commit is contained in:
Lauri Ojansivu 2020-04-25 14:15:58 +03:00 committed by GitHub
commit a84195179e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 34 deletions

View file

@ -1,7 +1,7 @@
import { Cookies } from 'meteor/ostrio:cookies'; import { Cookies } from 'meteor/ostrio:cookies';
const cookies = new Cookies(); const cookies = new Cookies();
const subManager = new SubsManager(); const subManager = new SubsManager();
const { calculateIndex, enableClickOnTouch } = Utils; const { calculateIndex } = Utils;
const swimlaneWhileSortingHeight = 150; const swimlaneWhileSortingHeight = 150;
BlazeComponent.extendComponent({ BlazeComponent.extendComponent({
@ -191,9 +191,6 @@ BlazeComponent.extendComponent({
}, },
}); });
// ugly touch event hotfix
enableClickOnTouch('.js-swimlane:not(.placeholder)');
this.autorun(() => { this.autorun(() => {
let showDesktopDragHandles = false; let showDesktopDragHandles = false;
currentUser = Meteor.user(); currentUser = Meteor.user();

View file

@ -1,5 +1,5 @@
const subManager = new SubsManager(); const subManager = new SubsManager();
const { calculateIndex, enableClickOnTouch } = Utils; const { calculateIndex } = Utils;
Template.boardListHeaderBar.events({ Template.boardListHeaderBar.events({
'click .js-open-archived-board'() { 'click .js-open-archived-board'() {
@ -68,9 +68,6 @@ 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(() => {
$boards.sortable('option', 'disabled', !userIsAllowedToMove()); $boards.sortable('option', 'disabled', !userIsAllowedToMove());

View file

@ -1,5 +1,5 @@
const subManager = new SubsManager(); const subManager = new SubsManager();
const { calculateIndexData, enableClickOnTouch } = Utils; const { calculateIndexData } = Utils;
let cardColors; let cardColors;
Meteor.startup(() => { Meteor.startup(() => {
@ -231,9 +231,6 @@ 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({
@ -269,9 +266,6 @@ 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();
} }
@ -279,10 +273,10 @@ BlazeComponent.extendComponent({
// Disable sorting if the current user is not a board member // Disable sorting if the current user is not a board member
this.autorun(() => { this.autorun(() => {
const disabled = !userIsMember() || Utils.isMiniScreen(); const disabled = !userIsMember() || Utils.isMiniScreen();
if ($checklistsDom.data('uiSortable')) { if ($checklistsDom.data('uiSortable') || $checklistsDom.data('sortable')) {
$checklistsDom.sortable('option', 'disabled', disabled); $checklistsDom.sortable('option', 'disabled', disabled);
} }
if ($subtasksDom.data('uiSortable')) { if ($subtasksDom.data('uiSortable') || $subtasksDom.data('sortable')) {
$subtasksDom.sortable('option', 'disabled', disabled); $subtasksDom.sortable('option', 'disabled', disabled);
} }
}); });

View file

@ -1,4 +1,4 @@
const { calculateIndexData, enableClickOnTouch, capitalize } = Utils; const { calculateIndexData, capitalize } = Utils;
function initSorting(items) { function initSorting(items) {
items.sortable({ items.sortable({
@ -36,9 +36,6 @@ 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({
@ -54,11 +51,15 @@ BlazeComponent.extendComponent({
return Meteor.user() && Meteor.user().isBoardMember(); return Meteor.user() && Meteor.user().isBoardMember();
} }
// Disable sorting if the current user is not a board member // Disable sorting if the current user is not a board member or is a miniscreen
self.autorun(() => { self.autorun(() => {
const $itemsDom = $(self.itemsDom); const $itemsDom = $(self.itemsDom);
if ($itemsDom.data('uiSortable')) { if ($itemsDom.data('uiSortable') || $itemsDom.data('sortable')) {
$(self.itemsDom).sortable('option', 'disabled', !userIsMember() || Utils.isMiniScreen()); $(self.itemsDom).sortable(
'option',
'disabled',
!userIsMember() || Utils.isMiniScreen(),
);
} }
}); });
}, },

View file

@ -1,6 +1,6 @@
import { Cookies } from 'meteor/ostrio:cookies'; import { Cookies } from 'meteor/ostrio:cookies';
const cookies = new Cookies(); const cookies = new Cookies();
const { calculateIndex, enableClickOnTouch } = Utils; const { calculateIndex } = Utils;
BlazeComponent.extendComponent({ BlazeComponent.extendComponent({
// Proxy // Proxy
@ -114,9 +114,6 @@ BlazeComponent.extendComponent({
}, },
}); });
// ugly touch event hotfix
enableClickOnTouch(itemsSelector);
this.autorun(() => { this.autorun(() => {
let showDesktopDragHandles = false; let showDesktopDragHandles = false;
currentUser = Meteor.user(); currentUser = Meteor.user();
@ -139,7 +136,7 @@ BlazeComponent.extendComponent({
}); });
} }
if ($cards.data('uiSortable')) { if ($cards.data('uiSortable') || $cards.data('sortable')) {
$cards.sortable( $cards.sortable(
'option', 'option',
'disabled', 'disabled',

View file

@ -1,6 +1,6 @@
import { Cookies } from 'meteor/ostrio:cookies'; import { Cookies } from 'meteor/ostrio:cookies';
const cookies = new Cookies(); const cookies = new Cookies();
const { calculateIndex, enableClickOnTouch } = Utils; const { calculateIndex } = Utils;
function currentListIsInThisSwimlane(swimlaneId) { function currentListIsInThisSwimlane(swimlaneId) {
const currentList = Lists.findOne(Session.get('currentList')); const currentList = Lists.findOne(Session.get('currentList'));
@ -87,9 +87,6 @@ function initSortable(boardComponent, $listsDom) {
}, },
}); });
// ugly touch event hotfix
enableClickOnTouch('.js-list:not(.js-list-composer)');
function userIsMember() { function userIsMember() {
return ( return (
Meteor.user() && Meteor.user() &&
@ -122,7 +119,7 @@ function initSortable(boardComponent, $listsDom) {
} }
const $listDom = $listsDom; const $listDom = $listsDom;
if ($listDom.data('uiSortable')) { if ($listDom.data('uiSortable') || $listDom.data('sortable')) {
$listsDom.sortable( $listsDom.sortable(
'option', 'option',
'disabled', 'disabled',