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: `
|
2022-07-05 16:48:28 +02:00
|
|
|
<ng-container>
|
|
|
|
<h6 class="uk-margin-remove multi-line-ellipsis lines-2">
|
|
|
|
<p class="uk-margin-remove">
|
|
|
|
<a *ngIf="externalPortalUrl" [href]="externalPortalUrl + projectUrl + '?projectId='+project['openaireId']" class="uk-link uk-link-heading">
|
|
|
|
{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}
|
|
|
|
</a>
|
|
|
|
<a *ngIf="!externalPortalUrl" [routerLink]="projectUrl" [queryParams]="routerHelper.createQueryParam('projectId',project['openaireId'])" class="uk-link uk-link-heading">
|
|
|
|
{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}
|
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
</h6>
|
|
|
|
</ng-container>
|
|
|
|
<span *ngIf="project['funderName']" class="uk-margin-small-top">
|
|
|
|
<span class="uk-text-muted">Funder: </span>{{project['funderName']}}
|
2021-02-10 11:24:52 +01:00
|
|
|
</span>
|
2017-12-19 13:53:46 +01:00
|
|
|
`
|
|
|
|
})
|
|
|
|
|
|
|
|
export class ProjectTitleFormatter {
|
2022-07-05 16:48:28 +02:00
|
|
|
@Input() project: any;
|
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
|
|
|
}
|
|
|
|
}
|