2017-12-19 13:53:46 +01:00
|
|
|
import {Component, Input, ElementRef} from '@angular/core';
|
2018-05-16 17:42:42 +02:00
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
@Component({
|
|
|
|
selector: 'fundedBy',
|
|
|
|
template: `
|
|
|
|
<dl class="uk-description-list-line">
|
|
|
|
<dt class="title">Funded By</dt>
|
|
|
|
<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>
|
|
|
|
|
|
|
|
<span class="uk-icon">
|
|
|
|
<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>
|
2018-05-16 17:42:42 +02:00
|
|
|
<div *ngIf="showNum > threshold" class="uk-text-right">
|
|
|
|
<a (click)="showNum = threshold; scroll()">
|
|
|
|
View less
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div *ngIf="showNum == threshold && fundedByProjects && fundedByProjects.length > 5">...</div>
|
|
|
|
<div *ngIf="showNum == threshold && fundedByProjects && fundedByProjects.length > 5" class="uk-text-right">
|
|
|
|
<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
|
|
|
|
|
|
|
constructor (private element: ElementRef) {}
|
|
|
|
|
|
|
|
ngOnInit() {}
|
|
|
|
|
|
|
|
public buildFundingTooltip(item: { "id": string, "acronym": string, "title": string,
|
|
|
|
"funderShortname": string, "funderName": string,
|
|
|
|
"funding": string, "code": string, "provenanceAction": string, inline: boolean}) {
|
|
|
|
let tooltipContent: string = "<div class='tooltip-custom-font-size uk-light uk-padding-small'>";
|
|
|
|
|
|
|
|
if(item.title) {
|
|
|
|
tooltipContent += "<h5>"+item.title+"</h5>";
|
|
|
|
}
|
|
|
|
|
|
|
|
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>";
|
|
|
|
}
|
2018-06-01 14:28:49 +02:00
|
|
|
tooltipContent += "<span class='uk-text-meta'>";
|
2017-12-19 13:53:46 +01:00
|
|
|
if(item.provenanceAction == 'Repository') {
|
2018-06-01 14:28:49 +02:00
|
|
|
tooltipContent += "Link provided by Repository";
|
2017-12-19 13:53:46 +01:00
|
|
|
} else if(item.provenanceAction == 'OpenAIRE') {
|
2018-06-01 14:28:49 +02:00
|
|
|
tooltipContent += "Link inferred by OpenAIRE";
|
2017-12-19 13:53:46 +01:00
|
|
|
} else if(item.provenanceAction == 'USer') {
|
2018-06-01 14:28:49 +02:00
|
|
|
tooltipContent += "Link claimed by User";
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
2018-06-01 14:28:49 +02:00
|
|
|
tooltipContent += "</span>";
|
2017-12-19 13:53:46 +01:00
|
|
|
tooltipContent+="</div>"
|
|
|
|
return tooltipContent;
|
|
|
|
}
|
|
|
|
|
|
|
|
public scroll() {
|
|
|
|
console.info("scroll into view");
|
|
|
|
if (typeof document !== 'undefined') {
|
|
|
|
this.element.nativeElement.scrollIntoView();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|