openaire-library/claims/claim-utils/entityFormatter/claimEntityFormatter.compon...

48 lines
1.8 KiB
TypeScript

import {Component, Input} from '@angular/core';
import {EnvProperties} from '../../../utils/properties/env-properties';
import {ClaimDBContext, ClaimDBProject, ClaimDBResult} from "../claimHelper.class";
//Usage Example "<claim-entity [entity]="" [type]="" > </claim-entity>"
//externalUrl
@Component({
selector: 'claim-entity',
template: `
<div *ngIf="type == 'publication' || type == 'dataset' || type == 'software' || type == 'other'"
[title]="(type == 'publication'?'Publication':(type == 'dataset'?'research data':(type == 'other'?'other research product':'software')))">
<div *ngIf="source" class="uk-text-meta title uk-margin-small-bottom">{{type == 'publication'?'publication':(type == 'dataset'?'research data':(type == 'other'?'other':'software'))}}</div>
<span *ngIf="!source" class="title">Link to {{type == 'publication'?'publication':(type == 'dataset'?'research data':(type == 'other'?'other':'software'))}}: </span>
<publication-title [entity]="entity" param="id"
path="/search/result" [externalPortalUrl]=externalPortalUrl></publication-title>
</div>
<div *ngIf="type == 'project' " title="Project">
<span class="uk-text-meta title">Link to project: </span>
<project-title [project]="entity" [searchLink]=properties.searchLinkToProject
[externalPortalUrl]=externalPortalUrl></project-title>
</div>
<div *ngIf="type == 'context' " title="Concept">
<span class="uk-text-meta title">Link to community: </span>{{entity.title}}
</div>
`
})
export class ClaimEntityFormatter {
@Input() entity: ClaimDBResult | ClaimDBContext | ClaimDBProject;
@Input() type: string;
@Input() properties: EnvProperties;
@Input() externalPortalUrl: string = null;
@Input() source: boolean = true;
constructor() {
}
ngOnInit() {
}
}