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

43 lines
1.6 KiB
TypeScript
Raw Normal View History

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: `
<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']}}
</span>
`
})
export class ProjectTitleFormatter {
@Input() project: any;
@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"];
}
}