import {Component, Input} from '@angular/core'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; @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 () {} 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 += ""; tooltipContent += item.provenanceAction; tooltipContent += ""; tooltipContent+="
"; return tooltipContent; } public scroll() { HelperFunctions.scroll(); } }