2017-12-19 13:53:46 +01:00
|
|
|
import {Component, Input} from '@angular/core';
|
|
|
|
import {RouterHelper} from '../../../utils/routerHelper.class';
|
2020-07-13 16:42:34 +02:00
|
|
|
import {properties} from "../../../../../environments/environment";
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
//Usage Example "<project-title [project]="X" > </project-title>"
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'project-title',
|
|
|
|
template: `
|
2021-02-10 11:24:52 +01:00
|
|
|
<span *ngIf="externalPortalUrl" class="project-title uk-text-large">
|
2019-07-23 14:23:12 +02:00
|
|
|
<span><a
|
2020-07-13 16:42:34 +02:00
|
|
|
[href]="externalPortalUrl + projectUrl + '?projectId='+project['openaireId']">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}</a></span>
|
2019-01-29 15:08:29 +01:00
|
|
|
</span>
|
2021-02-10 11:24:52 +01:00
|
|
|
<span *ngIf="!externalPortalUrl" class="project-title uk-text-large">
|
2019-07-23 14:23:12 +02:00
|
|
|
<span><a [queryParams]="routerHelper.createQueryParam('projectId',project['openaireId'])"
|
|
|
|
routerLinkActive="router-link-active"
|
2020-07-13 16:42:34 +02:00
|
|
|
[routerLink]="projectUrl">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}} </a></span>
|
2017-12-19 13:53:46 +01:00
|
|
|
</span>
|
2019-07-23 14:23:12 +02:00
|
|
|
|
2021-02-10 11:24:52 +01:00
|
|
|
<span *ngIf="project['funderName']">
|
|
|
|
<span class="uk-text-muted title"> Funder: </span>{{project['funderName']}}
|
|
|
|
</span>
|
2017-12-19 13:53:46 +01:00
|
|
|
`
|
|
|
|
})
|
|
|
|
|
|
|
|
export class ProjectTitleFormatter {
|
|
|
|
@Input() project: string[];
|
2018-02-05 14:14:59 +01:00
|
|
|
@Input() searchLink: string;
|
2019-07-23 14:23:12 +02:00
|
|
|
@Input() externalPortalUrl: string = null;
|
|
|
|
public url: string;
|
|
|
|
public routerHelper: RouterHelper = new RouterHelper();
|
2020-07-13 16:42:34 +02:00
|
|
|
public projectUrl = properties.searchLinkToProject.split('?')[0];
|
2019-07-23 14:23:12 +02:00
|
|
|
|
|
|
|
constructor() {
|
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
ngOnInit() {
|
2019-07-23 14:23:12 +02:00
|
|
|
this.url = this.searchLink + "?projectId=" + this.project["openaireId"];
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
}
|