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

pull/7969/head
Henriette Dinger 5 years ago
parent 40aa50670e
commit eb91a1e4af
  1. 13
      frontend/src/app/components/wp-grid/wp-grid.component.ts
  2. 4
      frontend/src/app/components/wp-table/embedded/wp-embedded-table.html
  3. 2
      frontend/src/app/modules/work_packages/routing/wp-list/wp.list.component.html

@ -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(

@ -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 -->

@ -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 -->

Loading…
Cancel
Save