1
|
import {Component, Input} from '@angular/core';
|
2
|
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
3
|
|
4
|
@Component({
|
5
|
selector: 'availableOn',
|
6
|
template: `
|
7
|
<dl class="uk-description-list-line">
|
8
|
<dt class="sideInfoTitle ">Download from</dt>
|
9
|
<dd class="line" *ngFor="let available of availableOn.slice(0, showNum) let i=index" >
|
10
|
<div>
|
11
|
<!--div class="{{available['bestAccessMode']}}"-->
|
12
|
<div [class]="available['bestAccessMode'] ? available['bestAccessMode'] : 'UNKNOWN ACCESSMODE'">
|
13
|
<span *ngIf="available.downloadUrl.length > 1"
|
14
|
class="custom-external custom-icon">
|
15
|
{{available.downloadName}}
|
16
|
<span *ngFor="let url of available.downloadUrl; let i=index;">
|
17
|
<a href="{{url}}" target="_blank"
|
18
|
|
19
|
attr.uk-tooltip="pos:right; delay:10"
|
20
|
[title]="available.accessMode[i] ? available.accessMode[i] : 'UNKNOWN ACCESSMODE'">
|
21
|
[{{(i+1) | number}}]
|
22
|
</a>
|
23
|
</span>
|
24
|
</span>
|
25
|
<a class="custom-external custom-icon"
|
26
|
*ngIf="available['downloadUrl'].length == 1"
|
27
|
href="{{available['downloadUrl']}}"
|
28
|
target="_blank"
|
29
|
|
30
|
attr.uk-tooltip="pos:right; delay:10"
|
31
|
[title]="available.bestAccessMode ? available.bestAccessMode : 'UNKNOWN ACCESSMODE'">
|
32
|
{{available.downloadName}}
|
33
|
</a>
|
34
|
<span *ngIf="available.collectedName" class="uk-text-bold">via</span>
|
35
|
<a *ngIf="available.collectedName"
|
36
|
[queryParams]="{datasourceId: available.collectedId}" routerLinkActive="router-link-active" routerLink="/search/dataprovider">
|
37
|
{{available.collectedName}}
|
38
|
</a>
|
39
|
<span *ngIf="available.type || available.year">(<span *ngIf="available.type">{{available.type}}<span *ngIf="available.year">, </span></span><span *ngIf="available.year">{{available.year}}</span>)</span>
|
40
|
</div>
|
41
|
</div>
|
42
|
</dd>
|
43
|
</dl>
|
44
|
|
45
|
<div *ngIf="showNum > threshold" class="uk-text-right">
|
46
|
<a (click)="showNum = threshold; scroll()">
|
47
|
View less
|
48
|
</a>
|
49
|
</div>
|
50
|
<div *ngIf="showNum == threshold && availableOn && availableOn.length > 5">...</div>
|
51
|
<div *ngIf="showNum == threshold && availableOn && availableOn.length > 5" class="uk-text-right">
|
52
|
<a (click)="showNum = availableOn.length;">
|
53
|
View more
|
54
|
</a>
|
55
|
</div>
|
56
|
`
|
57
|
})
|
58
|
|
59
|
export class AvailableOnComponent {
|
60
|
@Input() availableOn: { "downloadName": string, "downloadUrl": string[],
|
61
|
"collectedName": string, "collectedId": string,
|
62
|
"accessMode": string[], "bestAccessMode": string,
|
63
|
"type": string, "year":string }[];
|
64
|
|
65
|
public threshold: number = 5;
|
66
|
public showNum: number = 5;
|
67
|
|
68
|
constructor () {}
|
69
|
|
70
|
ngOnInit() {}
|
71
|
|
72
|
public scroll() {
|
73
|
HelperFunctions.scroll();
|
74
|
}
|
75
|
}
|