import {Component} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {Title, Meta} from '@angular/platform-browser'; import{EnvProperties} from '../../openaireLibrary/utils/properties/env-properties'; import {HelperService} from "../../openaireLibrary/utils/helper/helper.service"; import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper"; @Component({ selector: 'organizations', template: `
Organizations related to the community
` }) export class OrganizationsPageComponent { properties:EnvProperties; public pageContents = null; public divContents = null; public communityId = null; constructor ( private route: ActivatedRoute, private _router: Router, private _meta: Meta, private _title: Title, private helper: HelperService) {} public ngOnInit() { this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); this.updateUrl(data.envSpecific.baseLink+this._router.url); this.updateTitle("Organizations"); this.updateDescription("Organizations, open access"); //this.getDivContents(); this.getPageContents(); }); } private updateDescription(description:string){ this._meta.updateTag({content:description},"name='description'"); this._meta.updateTag({content:description},"property='og:description'"); } private updateTitle(title:string){ var _prefix ="OpenAIRE | "; var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); this._title.setTitle(_title); this._meta.updateTag({content:_title},"property='og:title'"); } private updateUrl(url:string){ this._meta.updateTag({content:url},"property='og:url'"); } private getPageContents() { this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { this.pageContents = contents; }) } private getDivContents() { this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { this.divContents = contents; }) } }