import {Component, Input} from '@angular/core'; import {EnvProperties} from "../../properties/env-properties"; import {ErrorCodes} from "../../properties/errorCodes"; @Component({ selector: 'search-tab', template: `
Recent {{getEntityName(resultType, true, true)}} {{customTitle}}
View all in search page
View all in search page
` }) export class SearchTabComponent { @Input() public fetch; @Input() public resultType: string; @Input() public params: any; @Input() public searchNumber: number = 5; @Input() public searchLinkToAdvancedPage: string; @Input() properties: EnvProperties; @Input() showImpactFactors; @Input() customTitle; @Input() showEnermaps: boolean; public errorCodes: ErrorCodes = new ErrorCodes(); public getEntityName(entityType: string, plural: boolean, full: boolean): string { if (entityType == "publication") { return "publication" + (plural ? "s" : ""); } else if (entityType == "dataset") { return (full ? "research data" : ("dataset" + (plural ? "s" : ""))); } else if (entityType == "software") { return "software"; } else if (entityType == "other") { return (full ? ("other research product" + (plural ? "s" : "")) : "other"); } else if (entityType == "result") { return ((full ? "research outcome" : "result") + (plural ? "s" : "")); } else if (entityType == "project") { return "project" + (plural ? "s" : ""); } else if (entityType == "dataprovider") { return ((full ? "content provider" : "dataprovider") + (plural ? "s" : "")); } } }