Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Disable Drag&Drop for mobile (only listening on reload, not resize)

Inga Maie924e5d19e3f
diff --git a/frontend/src/app/components/wp-card-view/wp-card-view.component.ts b/frontend/src/app/components/wp-card-view/wp-card-view.component.ts
index a49233eaa39..f5ab59471b6 100644
--- a/frontend/src/app/components/wp-card-view/wp-card-view.component.ts
+++ b/frontend/src/app/components/wp-card-view/wp-card-view.component.ts
@@ -33,6 +33,7 @@ import {CardViewHandlerRegistry} from "core-components/wp-card-view/event-handle
import {WorkPackageCardViewService} from "core-components/wp-card-view/services/wp-card-view.service";
import {WorkPackageCardDragAndDropService} from "core-components/wp-card-view/services/wp-card-drag-and-drop.service";
import {WorkPackageNotificationService} from "core-app/modules/work_packages/notifications/work-package-notification.service";
+import {DeviceService} from "core-app/modules/common/browser/device.service";
export type CardViewOrientation = 'horizontal'|'vertical';
@@ -100,7 +101,8 @@ export class WorkPackageCardViewComponent implements OnInit, AfterViewInit {
readonly wpTableSelection:WorkPackageViewSelectionService,
readonly wpViewOrder:WorkPackageViewOrderService,
readonly cardView:WorkPackageCardViewService,
- readonly cardDragDrop:WorkPackageCardDragAndDropService) {
+ readonly cardDragDrop:WorkPackageCardDragAndDropService,
+ readonly deviceService:DeviceService) {
}
ngOnInit() {
@@ -140,9 +142,12 @@ export class WorkPackageCardViewComponent implements OnInit, AfterViewInit {
}
ngAfterViewInit() {
- // Register Drag & Drop
this.cardDragDrop.init(this);
- this.cardDragDrop.registerDragAndDrop();
+
+ // Register Drag & Drop only on desktop
+ if (!this.deviceService.isMobile) {
+ this.cardDragDrop.registerDragAndDrop();
+ }
// Register event handlers for the cards
new CardViewHandlerRegistry(this.injector).attachTo(this);