turn contributors on project pages in to metadatarepresentations

This commit is contained in:
Art Lowel
2019-05-06 16:58:42 +02:00
parent bcf6f6a21b
commit 0d8291a0eb
2 changed files with 12 additions and 4 deletions

View File

@@ -10,10 +10,10 @@
[fields]="['project.identifier.status']"
[label]="'project.page.status'">
</ds-generic-item-page-field>
<ds-generic-item-page-field [item]="item"
[fields]="['project.contributor.other']"
[label]="'project.page.contributor'">
</ds-generic-item-page-field>
<ds-metadata-representation-list
[label]="'project.page.contributor' | translate"
[representations]="contributors$ | async">
</ds-metadata-representation-list>
<ds-generic-item-page-field [item]="item"
[fields]="['project.identifier.funder']"
[label]="'project.page.funder'">

View File

@@ -2,6 +2,7 @@ import { Component, Inject, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { ItemDataService } from '../../../../core/data/item-data.service';
import { Item } from '../../../../core/shared/item.model';
import { MetadataRepresentation } from '../../../../core/shared/metadata-representation/metadata-representation.model';
import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator';
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
import { isNotEmpty } from '../../../../shared/empty.util';
@@ -18,6 +19,11 @@ import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-rel
* The component for displaying metadata and relations of an item of the type Project
*/
export class ProjectComponent extends ItemComponent implements OnInit {
/**
* The contributors related to this project
*/
contributors$: Observable<MetadataRepresentation[]>;
/**
* The people related to this project
*/
@@ -44,6 +50,8 @@ export class ProjectComponent extends ItemComponent implements OnInit {
super.ngOnInit();
if (isNotEmpty(this.resolvedRelsAndTypes$)) {
this.contributors$ = this.buildRepresentations('OrgUnit', 'project.contributor.other', this.ids);
this.people$ = this.resolvedRelsAndTypes$.pipe(
filterRelationsByTypeLabel('isPersonOfProject'),
relationsToItems(this.item.id, this.ids)