2019-04-24 14:31:01 +02:00
|
|
|
import {Component, Input} from '@angular/core';
|
|
|
|
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
2018-05-16 17:42:42 +02:00
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
@Component({
|
|
|
|
selector: 'fundedBy',
|
|
|
|
template: `
|
2019-10-02 16:22:30 +02:00
|
|
|
<dl [class]="'uk-description-list-line' + ((fundedByProjects && fundedByProjects.length > threshold) ? ' uk-margin-remove-bottom' : '')">
|
2018-07-19 12:47:21 +02:00
|
|
|
<dt class="sideInfoTitle ">Funded by</dt>
|
2017-12-19 13:53:46 +01:00
|
|
|
<dd class="line"
|
2018-05-16 17:42:42 +02:00
|
|
|
*ngFor="let item of fundedByProjects.slice(0, showNum) let i=index">
|
|
|
|
<div><!-- *ngIf="i<5 || showAll"-->
|
2017-12-19 13:53:46 +01:00
|
|
|
<span uk-tooltip="pos:right; delay:10"
|
|
|
|
title="{{buildFundingTooltip(item)}}">
|
|
|
|
|
|
|
|
<a *ngIf="!item['inline'] && item.id"
|
|
|
|
[queryParams]="{projectId: item.id}" routerLinkActive="router-link-active" routerLink="/search/project">
|
|
|
|
<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>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<a *ngIf="item['inline'] && item.id"
|
|
|
|
[queryParams]="{projectId: item.id}" routerLinkActive="router-link-active" routerLink="/search/project">
|
|
|
|
<mark>
|
|
|
|
<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>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<span class="clickable" *ngIf="!item['inline'] && !item.id">
|
|
|
|
<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>
|
|
|
|
|
|
|
|
<span class="clickable" *ngIf="item['inline'] && !item.id">
|
|
|
|
<mark>
|
|
|
|
<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>
|
|
|
|
|
2019-06-12 13:50:48 +02:00
|
|
|
{{" "}}<span class="uk-icon">
|
2017-12-19 13:53:46 +01:00
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" icon="info" ratio="1"><path d="M12.13,11.59 C11.97,12.84 10.35,14.12 9.1,14.16 C6.17,14.2 9.89,9.46 8.74,8.37 C9.3,8.16 10.62,7.83 10.62,8.81 C10.62,9.63 10.12,10.55 9.88,11.32 C8.66,15.16 12.13,11.15 12.14,11.18 C12.16,11.21 12.16,11.35 12.13,11.59 C12.08,11.95 12.16,11.35 12.13,11.59 L12.13,11.59 Z M11.56,5.67 C11.56,6.67 9.36,7.15 9.36,6.03 C9.36,5 11.56,4.54 11.56,5.67 L11.56,5.67 Z"></path><circle fill="none" stroke="#000" stroke-width="1.1" cx="10" cy="10" r="9"></circle></svg>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</dd>
|
|
|
|
</dl>
|
2019-10-02 16:22:30 +02:00
|
|
|
<div *ngIf="showNum > threshold" class="uk-text-right uk-margin-bottom">
|
2018-05-16 17:42:42 +02:00
|
|
|
<a (click)="showNum = threshold; scroll()">
|
|
|
|
View less
|
|
|
|
</a>
|
|
|
|
</div>
|
2019-10-02 16:22:30 +02:00
|
|
|
<!-- <div *ngIf="showNum == threshold && fundedByProjects && fundedByProjects.length > 5">...</div>-->
|
|
|
|
<div *ngIf="showNum == threshold && fundedByProjects && fundedByProjects.length > threshold" class="uk-text-right uk-margin-bottom">
|
2018-05-16 17:42:42 +02:00
|
|
|
<a (click)="showNum = fundedByProjects.length;">
|
|
|
|
View more
|
|
|
|
</a>
|
|
|
|
</div>
|
2017-12-19 13:53:46 +01:00
|
|
|
`
|
|
|
|
})
|
|
|
|
|
|
|
|
export class FundedByComponent {
|
|
|
|
@Input() fundedByProjects: { "id": string, "acronym": string, "title": string,
|
|
|
|
"funderShortname": string, "funderName": string,
|
|
|
|
"funding": string, "code": string, "provenanceAction": string,
|
|
|
|
"inline": boolean }[];
|
2018-05-16 17:42:42 +02:00
|
|
|
|
|
|
|
public threshold: number = 5;
|
|
|
|
public showNum: number = 5;
|
2017-12-19 13:53:46 +01:00
|
|
|
|
2019-04-24 14:31:01 +02:00
|
|
|
constructor () {}
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
ngOnInit() {}
|
|
|
|
|
|
|
|
public buildFundingTooltip(item: { "id": string, "acronym": string, "title": string,
|
|
|
|
"funderShortname": string, "funderName": string,
|
|
|
|
"funding": string, "code": string, "provenanceAction": string, inline: boolean}) {
|
2019-10-09 15:28:23 +02:00
|
|
|
let tooltipContent: string = "<div class='tooltip-custom-font-size uk-padding-small uk-light'>";
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
if(item.title) {
|
2019-10-09 15:28:23 +02:00
|
|
|
tooltipContent += "<p class='uk-h5'>"+item.title+"</p>";
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(item.code || item.funderName || item.funderShortname || item.funding) {
|
|
|
|
tooltipContent += "<p>";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(item.code) {
|
|
|
|
tooltipContent += "<div>Project Code: "+item.code+"</div>";
|
|
|
|
}
|
|
|
|
if(item.funderName || item.funderShortname) {
|
|
|
|
tooltipContent += "<div>Funder: ";
|
|
|
|
if(item.funderName && item.funderShortname) {
|
|
|
|
tooltipContent += item.funderName + " ("+ item.funderShortname +")";
|
|
|
|
} else if(item.funderName) {
|
|
|
|
tooltipContent += item.funderName;
|
|
|
|
} else {
|
|
|
|
tooltipContent += item.funderShortname;
|
|
|
|
}
|
|
|
|
tooltipContent += "</div>";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(item.funding) {
|
|
|
|
tooltipContent += "<div>Funding: "+ item.funding + "</div>";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(item.code || item.funderName || item.funderShortname || item.funding) {
|
|
|
|
tooltipContent += "</p>";
|
|
|
|
}
|
2019-10-09 15:28:23 +02:00
|
|
|
tooltipContent += "<span class='uk-text-small'>";
|
|
|
|
tooltipContent += item.provenanceAction;
|
2018-06-01 14:28:49 +02:00
|
|
|
tooltipContent += "</span>";
|
2019-10-09 15:28:23 +02:00
|
|
|
tooltipContent+="</div>";
|
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
return tooltipContent;
|
|
|
|
}
|
|
|
|
|
|
|
|
public scroll() {
|
2019-04-24 14:31:01 +02:00
|
|
|
HelperFunctions.scroll();
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
}
|