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

Use single-card component in WP preview modal

Henriette Dinger77ab14f579a7
diff --git a/frontend/src/app/components/modals/preview-modal/wp-preview-modal/wp-preview.modal.html b/frontend/src/app/components/modals/preview-modal/wp-preview-modal/wp-preview.modal.html
index 553ca424dd9..258d4128ce9 100644
--- a/frontend/src/app/components/modals/preview-modal/wp-preview-modal/wp-preview.modal.html
+++ b/frontend/src/app/components/modals/preview-modal/wp-preview-modal/wp-preview.modal.html
@@ -1,24 +1,5 @@
-<div class="preview-modal--container" *ngIf="workPackage">
- <span class="type"
- [ngClass]="highlightingColor(workPackage.type)"
- [textContent]="workPackage.type.name">
- </span>
-
- <span class="subject -bold"
- [textContent]="workPackage.subject">
- </span>
-
- <span class="author -italic -small-font"
- [textContent]="'Created by ' + workPackage.author.name">
- </span>
-
- <div [ngClass]="'status ' + highlightingColor(workPackage.status, true)" >
- <span [textContent]="workPackage.status.name"></span>
- </div>
-
- <div class="assignee" *ngIf="workPackage.assignee">
- <user-avatar [user]="workPackage.assignee"
- data-class-list="avatar-mini">
- </user-avatar>
- </div>
+<div class="preview-modal--container" wp-isolated-query-space *ngIf="workPackage">
+ <wp-single-card [workPackage]="workPackage"
+ orientation="horizontal">
+ </wp-single-card>
</div>
diff --git a/frontend/src/app/components/modals/preview-modal/wp-preview-modal/wp-preview.modal.sass b/frontend/src/app/components/modals/preview-modal/wp-preview-modal/wp-preview.modal.sass
index be4911d171b..07d61e29f98 100644
--- a/frontend/src/app/components/modals/preview-modal/wp-preview-modal/wp-preview.modal.sass
+++ b/frontend/src/app/components/modals/preview-modal/wp-preview-modal/wp-preview.modal.sass
@@ -3,36 +3,6 @@
.preview-modal--container
position: absolute
z-index: 5000
- min-width: 400px
- max-width: 600px
- min-height: 100px
- max-height: 300px
- background: white
- padding: 15px
- border: 1px solid lightgrey
- border-radius: 3px
- box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.5)
-
- display: grid
- grid-template: auto auto auto / 150px auto 1fr 1fr
- grid-column-gap: 5px
- grid-row-gap: 10px
- grid-template-areas: "type subject subject subject" "author author author author" "status status . assignee"
-
-.status
- grid-area: status
- padding: 0px 10px
-
-.type
- @include text-shortener
- grid-area: type
-
-.author
- grid-area: author
-
-.subject
- @include text-shortener
- grid-area: subject
-
-.assignee
- grid-area: assignee
+ min-width: 350px
+ padding: 0px
+ box-shadow: 0px 0px 5px 2px rgba(0, 0, 0, 0.25)
diff --git a/frontend/src/app/components/modals/preview-modal/wp-preview-modal/wp-preview.modal.ts b/frontend/src/app/components/modals/preview-modal/wp-preview-modal/wp-preview.modal.ts
index db287ad5dcf..cd1236cde6d 100644
--- a/frontend/src/app/components/modals/preview-modal/wp-preview-modal/wp-preview.modal.ts
+++ b/frontend/src/app/components/modals/preview-modal/wp-preview-modal/wp-preview.modal.ts
@@ -32,9 +32,8 @@ import {OpModalLocalsToken, OpModalService} from "core-components/op-modals/op-m
import {OpModalLocalsMap} from "core-components/op-modals/op-modal.types";
import {I18nService} from "core-app/modules/common/i18n/i18n.service";
import {WorkPackageResource} from "core-app/modules/hal/resources/work-package-resource";
-import {WorkPackageDmService} from "core-app/modules/hal/dm-services/work-package-dm.service";
import {HalResource} from "core-app/modules/hal/resources/hal-resource";
-import {Highlighting} from "core-components/wp-fast-table/builders/highlighting/highlighting.functions";
+import {WorkPackageCacheService} from "core-components/work-packages/work-package-cache.service";
@Component({
templateUrl: './wp-preview.modal.html',
@@ -52,29 +51,20 @@ export class WpPreviewModal extends OpModalComponent implements OnInit {
@Inject(OpModalLocalsToken) readonly locals:OpModalLocalsMap,
readonly cdRef:ChangeDetectorRef,
readonly i18n:I18nService,
- readonly workPackageDmService:WorkPackageDmService,
+ readonly wpCacheService:WorkPackageCacheService,
readonly opModalService:OpModalService) {
super(locals, cdRef, elementRef);
}
-
ngOnInit() {
super.ngOnInit();
const workPackageLink = this.locals.workPackageLink;
const workPackageId = HalResource.idFromLink(workPackageLink);
- this.workPackageDmService.loadWorkPackageById(workPackageId)
+ this.wpCacheService.require(workPackageId)
.then((workPackage:WorkPackageResource) => {
this.workPackage = workPackage;
this.cdRef.detectChanges();
});
}
-
- highlightingColor(resource:HalResource, background:boolean = false) {
- if (background) {
- return Highlighting.backgroundClass(resource.$halType.toLowerCase(), resource.id!);
- } else {
- return Highlighting.inlineClass(resource.$halType.toLowerCase(), resource.id!);
- }
- }
}