openaire-library/landingPages/landing-utils/fundedBy.component.ts

83 lines
3.6 KiB
TypeScript
Raw Normal View History

import {Component, Input} from '@angular/core';
import {HelperFunctions} from "../../utils/HelperFunctions.class";
import {Project} from "../../utils/result-preview/result-preview";
@Component({
selector: 'fundedBy',
template: `
<li>
<span class="uk-text-muted">Funded by: </span>
<span *ngFor="let item of fundedByProjects.slice(0, showNum) let i=index">
<a>
<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>
</a>
<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">
<a *ngIf="item.id" class="uk-h6 uk-margin-remove portal-link"
[queryParams]="{projectId: item.id}" routerLink="/search/project">
{{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" class="uk-text-small uk-text-muted">
{{item.provenanceAction}}
</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>
</li>
`
})
export class FundedByComponent {
@Input() fundedByProjects: Project[];
public threshold: number = 5;
public showNum: number = 5;
public scroll() {
HelperFunctions.scroll();
}
}