openaire-library/claims/claim-utils/entityFormatter/projectTitleFormatter.compo...

30 lines
1.1 KiB
TypeScript

import {Component, Input} from '@angular/core';
import {RouterHelper} from '../../../utils/routerHelper.class';
//Usage Example "<project-title [project]="X" > </project-title>"
@Component({
selector: 'project-title',
template: `
<span *ngIf="externalPortalUrl" class="project-title">
<span ><a [href] = "externalPortalUrl + '/search/project?projectId='+project['openaireId']" >{{project['name']}} ({{project['funderName']}})</a></span>
</span>
<span *ngIf="!externalPortalUrl" class="project-title">
<span ><a [queryParams]="routerHelper.createQueryParam('projectId',project['openaireId'])" routerLinkActive="router-link-active" routerLink="/search/project" >{{project['name']}} ({{project['funderName']}})</a></span>
</span>
`
})
export class ProjectTitleFormatter {
@Input() project: string[];
@Input() searchLink: string;
@Input() externalPortalUrl:string = null;
public url:string;
public routerHelper:RouterHelper = new RouterHelper();
constructor () {}
ngOnInit() {
this.url =this.searchLink+ "?projectId=" + this.project["openaireId"];
}
}