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";
|
2018-05-16 17:42:42 +02:00
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
@Component({
|
|
|
|
selector: 'fundedBy',
|
|
|
|
template: `
|
2020-03-16 14:09:46 +01:00
|
|
|
<li>
|
|
|
|
<span class="uk-text-muted">Funded by: </span>
|
|
|
|
<span *ngFor="let item of fundedByProjects.slice(0, showNum) let i=index">
|
2020-03-19 13:26:55 +01:00
|
|
|
<a>
|
2020-03-16 14:09:46 +01:00
|
|
|
<mark *ngIf="item.inline">
|
|
|
|
<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>
|
|
|
|
</mark>
|
|
|
|
<span *ngIf="!item.inline">
|
|
|
|
<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>
|
2020-03-17 14:55:34 +01:00
|
|
|
</a>
|
2020-03-16 14:09:46 +01:00
|
|
|
<div class="default-dropdown uk-margin-remove-top uk-padding-small"
|
|
|
|
uk-dropdown="pos: bottom-left; mode:click">
|
|
|
|
<span class="uk-text-small">Project</span>
|
|
|
|
<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-03-16 14:09:46 +01:00
|
|
|
[queryParams]="{projectId: item.id}" routerLink="/search/project">
|
|
|
|
{{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">
|
|
|
|
{{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>
|
|
|
|
{{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" class="uk-text-small uk-text-muted">
|
|
|
|
{{item.provenanceAction}}
|
|
|
|
</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>
|
|
|
|
<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>
|
|
|
|
</li>
|
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;
|
|
|
|
|
|
|
|
public scroll() {
|
|
|
|
HelperFunctions.scroll();
|
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|