explore-services/portal/src/app/landingPages/showAuthors.component.ts

53 lines
1.6 KiB
TypeScript

import {Component, Input} from '@angular/core';
import {Router, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
@Component({
selector: 'showAuthors',
template: `
<span *ngIf="authors != undefined">
<div *ngIf="showAll">
<a class="text-muted" (click)="showAll = !showAll;">View less authors</a>
</div>
<span *ngFor="let item of authors.slice(0,30)">
<a class="custom-external" href="{{item['url']}}" target="_blank">
{{item['name']}};
</a>
</span>
<span *ngIf="!showAll && authors.length > 30"> ... </span>
<span *ngIf="showAll">
<span *ngFor="let item of authors.slice(30)">
<a class="custom-external" href="{{item['url']}}" target="_blank">
{{item['name']}};
</a>
</span>
</span>
<span *ngIf="!showAll && authors.length > 30">
<a class="text-muted" (click)="showAll = !showAll;">
view all {{authors.length}} authors
</a>
</span>
<span *ngIf="showAll">
<a class="text-muted" (click)="showAll = !showAll;">View less authors</a>
</span>
</span>
`
,
directives: [
...ROUTER_DIRECTIVES
]
})
export class ShowAuthorsComponent {
@Input() authors: { [key: string]: string }[];
private showAll: boolean = false;
constructor (private _router: Router) {
console.info('showAuthors constructor');
}
ngOnInit() {
}
}