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

Pass configuration object to card view and enable drag and drop only when allowed.

Henriette Dingereb91a1e4af8e
diff --git a/frontend/src/app/components/wp-grid/wp-grid.component.ts b/frontend/src/app/components/wp-grid/wp-grid.component.ts
index 091fea3cafe..0a9fe8d9b35 100644
--- a/frontend/src/app/components/wp-grid/wp-grid.component.ts
+++ b/frontend/src/app/components/wp-grid/wp-grid.component.ts
@@ -26,7 +26,7 @@
// See docs/COPYRIGHT.rdoc for more details.
// ++
-import {ChangeDetectionStrategy, ChangeDetectorRef, Component} from "@angular/core";
+import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from "@angular/core";
import {WorkPackageViewHighlightingService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-highlighting.service";
import {CardViewOrientation} from "core-components/wp-card-view/wp-card-view.component";
import {WorkPackageViewSortByService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-sort-by.service";
@@ -36,12 +36,13 @@ import {IsolatedQuerySpace} from "core-app/modules/work_packages/query-space/iso
import {DragAndDropService} from "core-app/modules/common/drag-and-drop/drag-and-drop.service";
import {WorkPackageCardDragAndDropService} from "core-components/wp-card-view/services/wp-card-drag-and-drop.service";
import {WorkPackagesListService} from "core-components/wp-list/wp-list.service";
+import {WorkPackageTableConfiguration} from "core-components/wp-table/wp-table-configuration";
@Component({
selector: 'wp-grid',
template: `
<wp-card-view [dragOutOfHandler]="canDragOutOf"
- [dragInto]="true"
+ [dragInto]="dragInto"
[cardsRemovable]="false"
[highlightingMode]="highlightingMode"
[showStatusButton]="true"
@@ -59,7 +60,10 @@ import {WorkPackagesListService} from "core-components/wp-list/wp-list.service";
]
})
export class WorkPackagesGridComponent {
- public canDragOutOf = () => { return true; };
+ @Input() public configuration:WorkPackageTableConfiguration;
+
+ public canDragOutOf:() => boolean;
+ public dragInto:boolean;
public gridOrientation:CardViewOrientation = 'horizontal';
public highlightingMode:HighlightingMode = 'none';
@@ -71,6 +75,9 @@ export class WorkPackagesGridComponent {
}
ngOnInit() {
+ this.dragInto = this.configuration.dragAndDropEnabled;
+ this.canDragOutOf = () => { return this.configuration.dragAndDropEnabled };
+
this.wpTableHighlight
.updates$()
.pipe(
diff --git a/frontend/src/app/components/wp-table/embedded/wp-embedded-table.html b/frontend/src/app/components/wp-table/embedded/wp-embedded-table.html
index 04b7f0f3d6b..fb202246b6d 100644
--- a/frontend/src/app/components/wp-table/embedded/wp-embedded-table.html
+++ b/frontend/src/app/components/wp-table/embedded/wp-embedded-table.html
@@ -20,7 +20,9 @@
<!-- GRID representation of the WP -->
<div class="work-packages-embedded-view--grid-view">
- <wp-grid *ngIf="configuration.isCardView"></wp-grid>
+ <wp-grid *ngIf="configuration.isCardView"
+ [configuration]="configuration">
+ </wp-grid>
</div>
<!-- Footer -->
diff --git a/frontend/src/app/modules/work_packages/routing/wp-list/wp.list.component.html b/frontend/src/app/modules/work_packages/routing/wp-list/wp.list.component.html
index 663f7c0c86c..3f4f12891b6 100644
--- a/frontend/src/app/modules/work_packages/routing/wp-list/wp.list.component.html
+++ b/frontend/src/app/modules/work_packages/routing/wp-list/wp.list.component.html
@@ -85,7 +85,7 @@
<!-- GRID representation of the WP -->
<div *ngIf="!showListView"
class="work-packages--card-view-container">
- <wp-grid></wp-grid>
+ <wp-grid [configuration]="wpTableConfiguration"></wp-grid>
</div>
<!-- Footer -->