Add BCF snapshot as cover image to WP cards

(cherry picked from commit 3eeebfb88d)
pull/7476/head
Wieland Lindenthal 5 years ago
parent 528f8c48a7
commit 2b45ee2a51
  1. 2
      frontend/src/app/components/wp-card-view/wp-card-view.component.html
  2. 6
      frontend/src/app/components/wp-card-view/wp-card-view.component.sass
  3. 14
      frontend/src/app/components/wp-card-view/wp-card-view.component.ts

@ -44,6 +44,8 @@
</div> </div>
</wp-edit-field-group> </wp-edit-field-group>
<img *ngIf="this.bcfSnapshotPath(wp)" [src]="this.bcfSnapshotPath(wp)" class="wp-card--cover-image">
<div *ngIf="!wp.isNew" <div *ngIf="!wp.isNew"
class="wp-card--content"> class="wp-card--content">
<span [textContent]="wpTypeAttribute(wp)" <span [textContent]="wpTypeAttribute(wp)"

@ -89,3 +89,9 @@ wp-edit-field
.wp-inline-create--reference-container .wp-inline-create--reference-container
margin-bottom: 3rem margin-bottom: 3rem
.wp-card--cover-image
display: block
margin: -10px -10px 10px
width: calc(100% + 10px + 10px)
max-width: calc(100% + 10px + 10px)

@ -33,10 +33,10 @@ import {AuthorisationService} from "core-app/modules/common/model-auth/model-aut
import {StateService} from "@uirouter/core"; import {StateService} from "@uirouter/core";
import {States} from "core-components/states.service"; import {States} from "core-components/states.service";
import {RequestSwitchmap} from "core-app/helpers/rxjs/request-switchmap"; import {RequestSwitchmap} from "core-app/helpers/rxjs/request-switchmap";
import {PathHelperService} from "core-app/modules/common/path-helper/path-helper.service";
import {filter} from 'rxjs/operators'; import {filter} from 'rxjs/operators';
import {CausedUpdatesService} from "core-app/modules/boards/board/caused-updates/caused-updates.service"; import {CausedUpdatesService} from "core-app/modules/boards/board/caused-updates/caused-updates.service";
@Component({ @Component({
selector: 'wp-card-view', selector: 'wp-card-view',
styleUrls: ['./wp-card-view.component.sass'], styleUrls: ['./wp-card-view.component.sass'],
@ -99,8 +99,9 @@ export class WorkPackageCardViewComponent implements OnInit {
readonly dragService:DragAndDropService, readonly dragService:DragAndDropService,
readonly reorderService:ReorderQueryService, readonly reorderService:ReorderQueryService,
readonly authorisationService:AuthorisationService, readonly authorisationService:AuthorisationService,
readonly causedUpdates:CausedUpdatesService,
readonly cdRef:ChangeDetectorRef, readonly cdRef:ChangeDetectorRef,
readonly causedUpdates:CausedUpdatesService) { readonly pathHelper:PathHelperService) {
} }
ngOnInit() { ngOnInit() {
@ -163,6 +164,15 @@ export class WorkPackageCardViewComponent implements OnInit {
return wp.subject; return wp.subject;
} }
public bcfSnapshotPath(wp:WorkPackageResource) {
let vp = _.get(wp, 'bcf.viewpoints[0]');
if (vp) {
return this.pathHelper.attachmentDownloadPath(vp.id, vp.file_name);
} else {
return null;
}
}
public cardHighlightingClass(wp:WorkPackageResource) { public cardHighlightingClass(wp:WorkPackageResource) {
return this.cardHighlighting(wp); return this.cardHighlighting(wp);
} }

Loading…
Cancel
Save