1
|
import {Component, Input} from '@angular/core';
|
2
|
|
3
|
@Component({
|
4
|
selector: 'showAuthors',
|
5
|
template: `
|
6
|
<span *ngIf="authors != undefined">
|
7
|
<div *ngIf="showAll">
|
8
|
<a class="uk-text-muted" (click)="showAll = !showAll;">View less authors</a>
|
9
|
</div>
|
10
|
<span *ngFor="let item of authors.slice(0,30) let i=index">
|
11
|
<!--a href="{{item['url']}}"-->
|
12
|
<a *ngIf="item.id" routerLinkActive="router-link-active" routerLink="/search/person" [queryParams]="{personId: item.id}">{{item['name']}}</a><span *ngIf="item.id && i<29 && i<(authors.length-1)">;</span>
|
13
|
<span *ngIf="!item.id">{{item['name']}}</span><span *ngIf="!item.id && i<29 && i<(authors.length-1)">;</span>
|
14
|
</span>
|
15
|
<span *ngIf="!showAll && authors.length > 30"> ... </span>
|
16
|
<span *ngIf="showAll">
|
17
|
<span *ngFor="let item of authors.slice(30) let i=index">
|
18
|
<!--a href="{{item['url']}}"-->
|
19
|
<a *ngIf="item.id" routerLinkActive="router-link-active" routerLink="/search/person" [queryParams]="{personId: item.id}">{{item['name']}}</a><span *ngIf="item.id && i<(authors.length-1)">;</span>
|
20
|
<span *ngIf="!item.id">{{item['name']}}</span><span *ngIf="!item.id && i<(authors.length-1)">;</span>
|
21
|
</span>
|
22
|
</span>
|
23
|
<span *ngIf="!showAll && authors.length > 30">
|
24
|
<a class="uk-text-muted" (click)="showAll = !showAll;">
|
25
|
view all {{authors.length}} authors
|
26
|
</a>
|
27
|
</span>
|
28
|
<span *ngIf="showAll">
|
29
|
<a class="uk-text-muted" (click)="showAll = !showAll;">View less authors</a>
|
30
|
</span>
|
31
|
</span>
|
32
|
|
33
|
`
|
34
|
|
35
|
})
|
36
|
|
37
|
export class ShowAuthorsComponent {
|
38
|
@Input() authors: { [key: string]: string }[];
|
39
|
private showAll: boolean = false;
|
40
|
|
41
|
constructor () {
|
42
|
}
|
43
|
|
44
|
ngOnInit() {
|
45
|
}
|
46
|
}
|