changes for adding stakeholder entities as enum
This commit is contained in:
parent
73dae143f3
commit
07c990824e
|
@ -6,6 +6,7 @@ import {CommunityInfo} from "../../connect/community/communityInfo";
|
|||
import {Router} from "@angular/router";
|
||||
import {LocalStorageService} from "../../services/localStorage.service";
|
||||
import {Stakeholder, StakeholderInfo, Visibility} from "../../monitor/entities/stakeholder";
|
||||
import {StringUtils} from '../../utils/string-utils.class';
|
||||
|
||||
@Component({
|
||||
selector: 'portal-search-result',
|
||||
|
@ -48,15 +49,11 @@ export class PortalSearchResultComponent implements OnInit{
|
|||
}
|
||||
|
||||
mapType(type: string) {
|
||||
if(type === 'ri') {
|
||||
return 'Research Initiative';
|
||||
} else if(type === 'community') {
|
||||
return 'Research Community'
|
||||
} else if(type === 'organization') {
|
||||
return 'Institution';
|
||||
} else {
|
||||
return type;
|
||||
}
|
||||
if(type === 'community') {
|
||||
return 'Research Community';
|
||||
} else {
|
||||
return StringUtils.getStakeholderType(type, false);
|
||||
}
|
||||
}
|
||||
|
||||
hasPermission(result: CommunityInfo & StakeholderInfo) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {UrlSegment} from '@angular/router';
|
||||
import {AbstractControl, FormGroup, ValidationErrors, ValidatorFn, Validators} from "@angular/forms";
|
||||
import {Stakeholder} from "../monitor/entities/stakeholder";
|
||||
import {Stakeholder, StakeholderEntities} from "../monitor/entities/stakeholder";
|
||||
import {CommunityInfo} from "../connect/community/communityInfo";
|
||||
import {properties} from "../../../environments/environment";
|
||||
import {OpenaireEntities} from "./properties/searchFields";
|
||||
|
@ -493,4 +493,17 @@ export class StringUtils {
|
|||
}
|
||||
return entityType.toLowerCase().replace(" ", "-");
|
||||
}
|
||||
|
||||
public static getStakeholderType(stakeholderType: string, plural: boolean = false): string {
|
||||
if(stakeholderType == "funder") {
|
||||
return plural ? StakeholderEntities.FUNDERS : StakeholderEntities.FUNDER;
|
||||
} else if(stakeholderType == "ri") {
|
||||
return plural ? StakeholderEntities.RIS : StakeholderEntities.RI;
|
||||
} else if(stakeholderType == "organization") {
|
||||
return plural ? StakeholderEntities.ORGANIZATIONS : StakeholderEntities.ORGANIZATION;
|
||||
} else if(stakeholderType == "project") {
|
||||
return plural ? StakeholderEntities.PROJECTS : StakeholderEntities.PROJECT;
|
||||
}
|
||||
return stakeholderType;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue