2019-04-24 14:31:01 +02:00
|
|
|
import {Component, Input} from '@angular/core';
|
|
|
|
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
2020-03-17 14:55:34 +01:00
|
|
|
import {Project} from "../../utils/result-preview/result-preview";
|
2020-07-10 10:37:17 +02:00
|
|
|
import {properties} from "../../../../environments/environment";
|
2018-05-16 17:42:42 +02:00
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
@Component({
|
2020-05-20 22:34:29 +02:00
|
|
|
selector: 'fundedBy',
|
|
|
|
template: `
|
|
|
|
<div class="uk-text-muted">Funded by</div>
|
|
|
|
<span *ngFor="let item of fundedByProjects.slice(0, showNum) let i=index">
|
2021-05-13 17:21:46 +02:00
|
|
|
<a>
|
|
|
|
<span>
|
2020-05-20 22:34:29 +02:00
|
|
|
<span
|
|
|
|
*ngIf="item['funderShortname'] || item['funderName']">{{item['funderShortname'] ? item['funderShortname'] : item['funderName']}}</span>
|
2020-03-16 14:09:46 +01:00
|
|
|
<span *ngIf="!item['funderShortname'] && !item['funderName']">[no funder available]</span>
|
2020-05-20 22:34:29 +02:00
|
|
|
<span
|
|
|
|
*ngIf="item['acronym'] || item['title']">| {{ item['acronym'] ? item['acronym'] : item['title']}}</span>
|
2020-03-16 14:09:46 +01:00
|
|
|
</span>
|
2020-03-17 14:55:34 +01:00
|
|
|
</a>
|
2020-05-25 20:58:13 +02:00
|
|
|
<div class="default-dropdown uk-margin-remove-top uk-padding-small uk-dropdown"
|
2020-03-16 14:09:46 +01:00
|
|
|
uk-dropdown="pos: bottom-left; mode:click">
|
2020-05-26 16:42:47 +02:00
|
|
|
<span>Project</span>
|
2020-03-16 14:09:46 +01:00
|
|
|
<div class="uk-margin-bottom">
|
2020-03-17 14:55:34 +01:00
|
|
|
<a *ngIf="item.id" class="uk-h6 uk-margin-remove portal-link"
|
2020-07-10 10:37:17 +02:00
|
|
|
[queryParams]="{projectId: item.id}" [routerLink]="url">
|
2020-05-20 22:34:29 +02:00
|
|
|
{{item['acronym'] ? item['acronym'] : item['title']}}
|
2017-12-19 13:53:46 +01:00
|
|
|
</a>
|
2020-03-16 14:09:46 +01:00
|
|
|
<span *ngIf="!item.id" class="uk-h6 uk-margin-remove">
|
2020-05-20 22:34:29 +02:00
|
|
|
{{item['acronym'] ? item['acronym'] : item['title']}}
|
2017-12-19 13:53:46 +01:00
|
|
|
</span>
|
2020-03-17 14:55:34 +01:00
|
|
|
<div *ngIf="item.acronym && item.title">
|
|
|
|
{{item.title}}
|
|
|
|
</div>
|
2020-03-16 14:09:46 +01:00
|
|
|
</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>
|
2020-05-20 22:34:29 +02:00
|
|
|
{{item.funderName ? item.funderName : item.funderShortname}}
|
2020-03-16 14:09:46 +01:00
|
|
|
<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>
|
2021-05-13 17:48:01 +02:00
|
|
|
<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>
|
2020-03-16 14:09:46 +01:00
|
|
|
</div>
|
2017-12-19 13:53:46 +01:00
|
|
|
</div>
|
2020-03-16 14:09:46 +01:00
|
|
|
<span *ngIf="i < (fundedByProjects.slice(0, showNum).length - 1)">, </span>
|
|
|
|
</span>
|
2020-05-20 22:34:29 +02:00
|
|
|
<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>
|
|
|
|
`
|
|
|
|
})
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
export class FundedByComponent {
|
2020-03-17 14:55:34 +01:00
|
|
|
@Input() fundedByProjects: Project[];
|
|
|
|
|
|
|
|
public threshold: number = 5;
|
|
|
|
public showNum: number = 5;
|
2020-07-10 10:37:17 +02:00
|
|
|
public url = properties.searchLinkToProject.split('?')[0];
|
2020-03-17 14:55:34 +01:00
|
|
|
|
|
|
|
public scroll() {
|
|
|
|
HelperFunctions.scroll();
|
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|