1
|
import {Component, Input} from '@angular/core';
|
2
|
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
3
|
|
4
|
// NOT USED
|
5
|
@Component({
|
6
|
selector: 'publishedIn',
|
7
|
template: `
|
8
|
<dl [class]="'uk-description-list-line' + ((publishedIn && publishedIn.size > threshold) ? ' uk-margin-remove-bottom' : '')">
|
9
|
<dt class="title">Published in</dt>
|
10
|
<dd class="line" *ngFor="let key of getKeys(publishedIn) let i=index">
|
11
|
<div *ngIf="i<5 || showAll" class="{{publishedIn.get(key)['bestAccessMode']}}">
|
12
|
<span [class]="publishedIn.get(key)['url'].length > 0 ? 'custom-external custom-icon' : ''">
|
13
|
<span *ngIf="publishedIn.get(key)['url'].length > 1">
|
14
|
{{key}}
|
15
|
<span *ngFor="let url of publishedIn.get(key)['url']; let i=index">
|
16
|
<a href="{{url}}" target="_blank"
|
17
|
[attr.uk-tooltip]="publishedIn.get(key)['accessMode'][i] ? 'pos:right; delay:10' : 'cls: uk-invisible'"
|
18
|
[title]="publishedIn.get(key)['accessMode'][i]">
|
19
|
[{{i+1}}]
|
20
|
</a>
|
21
|
</span>
|
22
|
</span>
|
23
|
<a *ngIf="publishedIn.get(key)['url'].length == 1"
|
24
|
href="{{publishedIn.get(key)['url']}}"
|
25
|
target="_blank"
|
26
|
[attr.uk-tooltip]="publishedIn.get(key)['bestAccessMode'] ? 'pos:right; delay:10' : 'cls: uk-invisible'"
|
27
|
[title]="publishedIn.get(key)['bestAccessMode']">
|
28
|
{{key}}
|
29
|
</a>
|
30
|
<span *ngIf="publishedIn.get(key)['url'].length == 0"
|
31
|
[attr.uk-tooltip]="publishedIn.get(key)['bestAccessMode'] ? 'pos:right; delay:10' : 'cls: uk-invisible'"
|
32
|
[title]="publishedIn.get(key)['bestAccessMode']">
|
33
|
{{key}}
|
34
|
</span>
|
35
|
</span>
|
36
|
</div>
|
37
|
</dd>
|
38
|
<dd *ngIf="showAll" class="uk-text-right uk-margin-bottom">
|
39
|
<a class="uk-text-muted" (click)="showAll = !showAll; scroll()">
|
40
|
View less
|
41
|
</a>
|
42
|
</dd>
|
43
|
<!-- <dd *ngIf="!showAll && publishedIn.size > 5">...</dd>-->
|
44
|
<dd *ngIf="!showAll && publishedIn.size > 5" class="uk-text-right uk-margin-bottom">
|
45
|
<a class="uk-text-muted" (click)="showAll = !showAll;">
|
46
|
View more
|
47
|
</a>
|
48
|
</dd>
|
49
|
</dl>
|
50
|
`
|
51
|
})
|
52
|
|
53
|
// NOT USED
|
54
|
export class PublishedInComponent {
|
55
|
public threshold: number = 5;
|
56
|
public showNum: number = 5;
|
57
|
|
58
|
//key is name
|
59
|
@Input() publishedIn: Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>;
|
60
|
|
61
|
public showAll: boolean = false;
|
62
|
|
63
|
constructor () {}
|
64
|
|
65
|
ngOnInit() {}
|
66
|
|
67
|
public scroll() {
|
68
|
HelperFunctions.scroll();
|
69
|
}
|
70
|
public getKeys( map) {
|
71
|
return Array.from(map.keys());
|
72
|
}
|
73
|
}
|