import {Component, Input, ElementRef} from '@angular/core'; @Component({ selector: 'fundedBy', template: `
Funded By
{{item['funderShortname']?item['funderShortname']:item['funderName']}} [no funder available] | {{ item['acronym']?item['acronym']:item['title']}} {{item['funderShortname']?item['funderShortname']:item['funderName']}} [no funder available] | {{ item['acronym']?item['acronym']:item['title']}} {{item['funderShortname']?item['funderShortname']:item['funderName']}} [no funder available] | {{ item['acronym']?item['acronym']:item['title']}} {{item['funderShortname']?item['funderShortname']:item['funderName']}} [no funder available] | {{ item['acronym']?item['acronym']:item['title']}}
View less
...
View more
` }) export class FundedByComponent { @Input() fundedByProjects: { "id": string, "acronym": string, "title": string, "funderShortname": string, "funderName": string, "funding": string, "code": string, "provenanceAction": string, "inline": boolean }[]; public showAll: boolean = false; 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 = "
"; if(item.title) { tooltipContent += "
"+item.title+"
"; } if(item.code || item.funderName || item.funderShortname || item.funding) { tooltipContent += "

"; } if(item.code) { tooltipContent += "

Project Code: "+item.code+"
"; } if(item.funderName || item.funderShortname) { tooltipContent += "
Funder: "; if(item.funderName && item.funderShortname) { tooltipContent += item.funderName + " ("+ item.funderShortname +")"; } else if(item.funderName) { tooltipContent += item.funderName; } else { tooltipContent += item.funderShortname; } tooltipContent += "
"; } if(item.funding) { tooltipContent += "
Funding: "+ item.funding + "
"; } if(item.code || item.funderName || item.funderShortname || item.funding) { tooltipContent += "

"; } if(item.provenanceAction == 'Repository') { tooltipContent += "Provided by Repository"; } else if(item.provenanceAction == 'OpenAIRE') { tooltipContent += "Inferred by OpenAIRE"; } else if(item.provenanceAction == 'USer') { tooltipContent += "Claimed by User"; } tooltipContent+="
" return tooltipContent; } public scroll() { console.info("scroll into view"); if (typeof document !== 'undefined') { this.element.nativeElement.scrollIntoView(); } } }