Project

General

Profile

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)">
11
                  <a href="{{item['url']}}">
12
                  <!--a routerLinkActive="router-link-active" routerLink="/search/person" [queryParams]="{personId: 'datacite____::9da3a037961b36a634fcd40ab0bf6535'}" -->
13
                    {{item['name']}};
14
                </a>
15
            </span>
16
            <span *ngIf="!showAll && authors.length > 30">	... </span>
17
            <span *ngIf="showAll">
18
                <span *ngFor="let item of authors.slice(30)">
19
                    <a href="{{item['url']}}">
20
                        {{item['name']}};
21
                    </a>
22
                </span>
23
            </span>
24
            <span *ngIf="!showAll && authors.length > 30">
25
                <a class="uk-text-muted" (click)="showAll = !showAll;">
26
                    view all {{authors.length}} authors
27
                </a>
28
            </span>
29
            <span *ngIf="showAll">
30
                <a class="uk-text-muted" (click)="showAll = !showAll;">View less authors</a>
31
            </span>
32
        </span>
33

    
34
    `
35

    
36
    })
37

    
38
export class ShowAuthorsComponent {
39
    @Input() authors: { [key: string]: string }[];
40
    private showAll: boolean = false;
41

    
42
    constructor () {
43
        console.info('showAuthors constructor');
44
    }
45

    
46
    ngOnInit() {
47
    }
48
}
(6-6/11)