1
|
import {Component, Input} from '@angular/core';
|
2
|
import {ClaimEntity} from '../../claim-utils/claimHelper.class';
|
3
|
import {StringUtils} from "../../../utils/string-utils.class";
|
4
|
|
5
|
@Component({
|
6
|
selector: 'claim-title',
|
7
|
template:
|
8
|
`
|
9
|
<span class="uk-text-bold">
|
10
|
<a *ngIf="entity.result && entity.result.url" target="_blank" [href]="entity.result.url"
|
11
|
class="uk-link">{{entity.title ? sliceString(entity.title) : '[No title available]'}}</a>
|
12
|
<span
|
13
|
*ngIf="(entity.result && !entity.result.url)">{{entity.title ? sliceString(entity.title) : '[No title available]'}}</span>
|
14
|
<span *ngIf="entity.type=='project' && entity.project">
|
15
|
<a *ngIf="entity.project && entity.project.url" target="_blank" [href]="entity.project.url"
|
16
|
class="uk-link">
|
17
|
<span *ngIf="!shortVersion">
|
18
|
{{(entity.project.acronym ? '[' + entity.project.acronym + '] ' : '') + entity.title}}
|
19
|
</span>
|
20
|
<span *ngIf="shortVersion">
|
21
|
{{(entity.project.acronym ? sliceString(entity.project.acronym):sliceString(entity.title))}}
|
22
|
</span>
|
23
|
</a>
|
24
|
<span
|
25
|
*ngIf="(entity.project && !entity.project.url)">
|
26
|
<span *ngIf="!shortVersion">
|
27
|
{{(entity.project.acronym ? '[' + entity.project.acronym + '] ' : '') + entity.title}}
|
28
|
</span>
|
29
|
<span *ngIf="shortVersion">
|
30
|
{{(entity.project.acronym ? sliceString(entity.project.acronym):sliceString(entity.title))}}
|
31
|
</span>
|
32
|
</span>
|
33
|
|
34
|
|
35
|
</span>
|
36
|
<span *ngIf="entity.type=='community' && entity.context">
|
37
|
<span *ngIf=" entity.context.community != entity.context.concept.label">
|
38
|
{{entity.context.community }} > {{entity.context.category}} >
|
39
|
</span>
|
40
|
<span> {{entity.context.concept.label}}</span>
|
41
|
</span>
|
42
|
</span>
|
43
|
`
|
44
|
|
45
|
|
46
|
})
|
47
|
export class ClaimEntityTitleComponent {
|
48
|
|
49
|
|
50
|
@Input() entity: ClaimEntity;
|
51
|
@Input() slice:boolean = false;
|
52
|
@Input() sliceSize:number = 45;
|
53
|
@Input() shortVersion: boolean = false;
|
54
|
|
55
|
ngOnInit() {
|
56
|
|
57
|
|
58
|
}
|
59
|
sliceString(mystr:string): string {
|
60
|
if(this.slice){
|
61
|
return StringUtils.sliceString(mystr,this.sliceSize);
|
62
|
}
|
63
|
return mystr;
|
64
|
}
|
65
|
|
66
|
}
|