1 |
61381
|
k.triantaf
|
import {Component, Input} from '@angular/core';
|
2 |
|
|
import {RouterHelper} from '../../../utils/routerHelper.class';
|
3 |
|
|
import {properties} from "../../../../../environments/environment";
|
4 |
|
|
|
5 |
|
|
//Usage Example "<project-title [project]="X" > </project-title>"
|
6 |
|
|
|
7 |
|
|
@Component({
|
8 |
|
|
selector: 'project-title',
|
9 |
|
|
template: `
|
10 |
|
|
<span *ngIf="externalPortalUrl" class="project-title uk-text-large">
|
11 |
|
|
<span><a
|
12 |
|
|
[href]="externalPortalUrl + projectUrl + '?projectId='+project['openaireId']">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}</a></span>
|
13 |
|
|
</span>
|
14 |
|
|
<span *ngIf="!externalPortalUrl" class="project-title uk-text-large">
|
15 |
|
|
<span><a [queryParams]="routerHelper.createQueryParam('projectId',project['openaireId'])"
|
16 |
|
|
routerLinkActive="router-link-active"
|
17 |
|
|
[routerLink]="projectUrl">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}} </a></span>
|
18 |
|
|
</span>
|
19 |
|
|
|
20 |
|
|
<span *ngIf="project['funderName']">
|
21 |
|
|
<span class="uk-text-muted title"> Funder: </span>{{project['funderName']}}
|
22 |
|
|
</span>
|
23 |
|
|
`
|
24 |
|
|
})
|
25 |
|
|
|
26 |
|
|
export class ProjectTitleFormatter {
|
27 |
|
|
@Input() project: string[];
|
28 |
|
|
@Input() searchLink: string;
|
29 |
|
|
@Input() externalPortalUrl: string = null;
|
30 |
|
|
public url: string;
|
31 |
|
|
public routerHelper: RouterHelper = new RouterHelper();
|
32 |
|
|
public projectUrl = properties.searchLinkToProject.split('?')[0];
|
33 |
|
|
|
34 |
|
|
constructor() {
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
ngOnInit() {
|
38 |
|
|
this.url = this.searchLink + "?projectId=" + this.project["openaireId"];
|
39 |
|
|
}
|
40 |
|
|
}
|