87 lines
3.2 KiB
TypeScript
87 lines
3.2 KiB
TypeScript
import {Component, Input} from '@angular/core';
|
|
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
|
import {Project} from "../../utils/result-preview/result-preview";
|
|
import {properties} from "../../../../environments/environment";
|
|
|
|
@Component({
|
|
selector: 'fundedBy',
|
|
template: `
|
|
<div class="sideInfoTitle">
|
|
<span>Funded by</span>
|
|
</div>
|
|
<div class="uk-padding-small">
|
|
<span *ngFor="let item of fundedByProjects.slice(0, showNum) let i=index">
|
|
<a>
|
|
<span>
|
|
<span
|
|
*ngIf="item['funderShortname'] || item['funderName']">{{item['funderShortname'] ? item['funderShortname'] : item['funderName']}}</span>
|
|
<span *ngIf="!item['funderShortname'] && !item['funderName']">[no funder available]</span>
|
|
<span
|
|
*ngIf="item['acronym'] || item['title']">| {{ item['acronym'] ? item['acronym'] : item['title']}}</span>
|
|
</span>
|
|
</a>
|
|
<div class="default-dropdown uk-margin-remove-top uk-padding-small uk-dropdown"
|
|
uk-dropdown="pos: bottom-left; mode:click">
|
|
<span>Project</span>
|
|
<div class="uk-margin-bottom">
|
|
<a *ngIf="item.id" class="uk-h6 uk-margin-remove portal-link"
|
|
[queryParams]="{projectId: item.id}" [routerLink]="url">
|
|
{{item['acronym'] ? item['acronym'] : item['title']}}
|
|
</a>
|
|
<span *ngIf="!item.id" class="uk-h6 uk-margin-remove">
|
|
{{item['acronym'] ? item['acronym'] : item['title']}}
|
|
</span>
|
|
<div *ngIf="item.acronym && item.title">
|
|
{{item.title}}
|
|
</div>
|
|
</div>
|
|
<ul class="uk-list uk-padding-remove-left uk-margin-bottom">
|
|
<li *ngIf="item.funderShortname || item.funderName">
|
|
<span class="uk-text-muted">Funder: </span>
|
|
{{item.funderName ? item.funderName : item.funderShortname}}
|
|
<span *ngIf="item.funderShortname && item.funderName">
|
|
({{item.funderShortname}})
|
|
</span>
|
|
</li>
|
|
<li *ngIf="item.code">
|
|
<span class="uk-text-muted">Project Code: </span>{{item.code}}
|
|
</li>
|
|
<li *ngIf="item.funding">
|
|
<span class="uk-text-muted">Funding stream: </span>{{item.funding}}
|
|
</li>
|
|
</ul>
|
|
<div *ngIf="item.provenanceAction || item.validated" class="uk-text-muted">
|
|
<span *ngIf="item.validated">Validated by funder</span>
|
|
<span *ngIf="item.provenanceAction && item.validated"> | </span>
|
|
<span *ngIf="item.provenanceAction">{{item.provenanceAction}}</span>
|
|
</div>
|
|
</div>
|
|
<span *ngIf="i < (fundedByProjects.slice(0, showNum).length - 1)">, </span>
|
|
</span>
|
|
<div *ngIf="showNum > threshold" class="uk-text-right uk-margin-bottom">
|
|
<a (click)="showNum = threshold; scroll()">
|
|
View less
|
|
</a>
|
|
</div>
|
|
<div *ngIf="showNum == threshold && fundedByProjects && fundedByProjects.length > threshold"
|
|
class="uk-text-right uk-margin-bottom">
|
|
<a (click)="showNum = fundedByProjects.length;">
|
|
View more
|
|
</a>
|
|
</div>
|
|
</div>
|
|
`
|
|
})
|
|
|
|
export class FundedByComponent {
|
|
@Input() fundedByProjects: Project[];
|
|
|
|
public threshold: number = 5;
|
|
public showNum: number = 5;
|
|
public url = properties.searchLinkToProject.split('?')[0];
|
|
|
|
public scroll() {
|
|
HelperFunctions.scroll();
|
|
}
|
|
}
|