41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import {Component, Input} from '@angular/core';
|
|
import {RouterHelper} from '../../../utils/routerHelper.class';
|
|
import {properties} from "../../../../../environments/environment";
|
|
|
|
//Usage Example "<project-title [project]="X" > </project-title>"
|
|
|
|
@Component({
|
|
selector: 'project-title',
|
|
template: `
|
|
<span *ngIf="externalPortalUrl" class="project-title">
|
|
<span><a
|
|
[href]="externalPortalUrl + projectUrl + '?projectId='+project['openaireId']">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}</a></span>
|
|
</span>
|
|
<span *ngIf="!externalPortalUrl" class="project-title">
|
|
<span><a [queryParams]="routerHelper.createQueryParam('projectId',project['openaireId'])"
|
|
routerLinkActive="router-link-active"
|
|
[routerLink]="projectUrl">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}} </a></span>
|
|
</span>
|
|
|
|
<div *ngIf="project['funderName']">
|
|
<span class="uk-text-muted">Funder </span>{{project['funderName']}}
|
|
</div>
|
|
`
|
|
})
|
|
|
|
export class ProjectTitleFormatter {
|
|
@Input() project: string[];
|
|
@Input() searchLink: string;
|
|
@Input() externalPortalUrl: string = null;
|
|
public url: string;
|
|
public routerHelper: RouterHelper = new RouterHelper();
|
|
public projectUrl = properties.searchLinkToProject.split('?')[0];
|
|
|
|
constructor() {
|
|
}
|
|
|
|
ngOnInit() {
|
|
this.url = this.searchLink + "?projectId=" + this.project["openaireId"];
|
|
}
|
|
}
|