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 threshold: number = 5; public showNum: number = 5; 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 += "

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