2019-10-02 16:20:34 +02:00
|
|
|
import {Component, Input} from '@angular/core';
|
|
|
|
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'relatedTo',
|
|
|
|
template: `
|
2020-03-16 14:09:46 +01:00
|
|
|
<div class="uk-margin-bottom">
|
|
|
|
<div class="uk-text-small">
|
|
|
|
<div class="uk-text-muted">
|
|
|
|
Communities:
|
|
|
|
</div>
|
|
|
|
<div class="uk-margin-small-left" *ngFor="let item of contexts.slice(0, showNum); let i=index">
|
|
|
|
<span *ngIf="!item['inline']">
|
|
|
|
<span>{{item['labelContext']}}</span>
|
|
|
|
<span *ngIf="item['labelCategory']"><span uk-icon="icon: arrow-right"></span>{{item['labelCategory']}}</span>
|
|
|
|
<span *ngIf="item['labelConcept']">: {{item['labelConcept']}}</span>
|
|
|
|
</span>
|
|
|
|
<mark *ngIf="item['inline']">
|
|
|
|
<span>{{item['labelContext']}}</span>
|
|
|
|
<span *ngIf="item['labelCategory']"><span
|
|
|
|
uk-icon="icon: arrow-right"></span>{{item['labelCategory']}}</span>
|
|
|
|
<span *ngIf="item['labelConcept']">: {{item['labelConcept']}}</span>
|
|
|
|
</mark>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div *ngIf="showNum > threshold" class="uk-text-right">
|
|
|
|
<a (click)="showNum = threshold; scroll()">
|
|
|
|
View less
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div *ngIf="showNum == threshold && contexts && contexts.length > threshold" class="uk-text-right">
|
|
|
|
<a (click)="showNum = contexts.length;">
|
|
|
|
View more
|
|
|
|
</a>
|
|
|
|
</div>
|
2019-10-02 16:20:34 +02:00
|
|
|
</div>
|
|
|
|
`
|
|
|
|
})
|
|
|
|
|
|
|
|
export class RelatedToComponent {
|
2020-03-16 14:09:46 +01:00
|
|
|
@Input() contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean }[];
|
|
|
|
|
2019-10-02 16:20:34 +02:00
|
|
|
public threshold: number = 5;
|
|
|
|
public showNum: number = 5;
|
2020-03-16 14:09:46 +01:00
|
|
|
|
|
|
|
constructor() {
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
}
|
|
|
|
|
2019-10-02 16:20:34 +02:00
|
|
|
public scroll() {
|
|
|
|
HelperFunctions.scroll();
|
|
|
|
}
|
|
|
|
}
|