1
|
import {Component, Input} from '@angular/core';
|
2
|
import {EnvProperties} from '../../../utils/properties/env-properties';
|
3
|
import {ClaimDBContext, ClaimDBProject, ClaimDBResult} from "../claimHelper.class";
|
4
|
|
5
|
//Usage Example "<claim-entity [entity]="" [type]="" > </claim-entity>"
|
6
|
|
7
|
//externalUrl
|
8
|
@Component({
|
9
|
selector: 'claim-entity',
|
10
|
template: `
|
11
|
<div *ngIf="type == 'publication' || type == 'dataset' || type == 'software' || type == 'other'"
|
12
|
[title]="(type == 'publication'?'Publication':(type == 'dataset'?'research data':(type == 'other'?'other research product':'software')))">
|
13
|
<div *ngIf="source" class="uk-text-muted title">{{type == 'publication'?'publication':(type == 'dataset'?'research data':(type == 'other'?'other':'software'))}}</div>
|
14
|
|
15
|
<span *ngIf="!source" class="title">Link to {{type == 'publication'?'publication':(type == 'dataset'?'research data':(type == 'other'?'other':'software'))}}: </span>
|
16
|
<publication-title [entity]="entity" param="id"
|
17
|
path="/search/result" [externalPortalUrl]=externalPortalUrl></publication-title>
|
18
|
</div>
|
19
|
|
20
|
<div *ngIf="type == 'project' " title="Project">
|
21
|
<span class="uk-text-muted title">Link to project: </span>
|
22
|
|
23
|
<project-title [project]="entity" [searchLink]=properties.searchLinkToProject
|
24
|
[externalPortalUrl]=externalPortalUrl></project-title>
|
25
|
</div>
|
26
|
<div *ngIf="type == 'context' " title="Concept">
|
27
|
<span class="uk-text-muted title">Link to community: </span> <span class="uk-text-large">{{entity.title}}</span>
|
28
|
</div>
|
29
|
`
|
30
|
})
|
31
|
|
32
|
export class ClaimEntityFormatter {
|
33
|
@Input() entity: ClaimDBResult | ClaimDBContext | ClaimDBProject;
|
34
|
@Input() type: string;
|
35
|
@Input() properties: EnvProperties;
|
36
|
@Input() externalPortalUrl: string = null;
|
37
|
@Input() source: boolean = true;
|
38
|
|
39
|
constructor() {
|
40
|
}
|
41
|
|
42
|
ngOnInit() {
|
43
|
}
|
44
|
|
45
|
|
46
|
}
|
47
|
|