1
|
import {Component} from '@angular/core';
|
2
|
import {ActivatedRoute, Router} from '@angular/router';
|
3
|
import {Title, Meta} from '@angular/platform-browser';
|
4
|
import{EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
5
|
import {HelperService} from "../../openaireLibrary/utils/helper/helper.service";
|
6
|
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
|
7
|
|
8
|
@Component({
|
9
|
selector: 'organizations',
|
10
|
template: `
|
11
|
<div class=" uk-section tm-middle uk-container uk-padding-remove-top uk-margin-top" id="tm-main">
|
12
|
<div class="uk-container uk-margin-bottom">
|
13
|
<div class="uk-article-title custom-article-title uk-margin-bottom"> Organizations related to the community
|
14
|
</div>
|
15
|
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
|
16
|
[texts]="pageContents['top']"></helper>
|
17
|
<affiliations [longView]="true" [getAffiliationsFromAPI]="true"></affiliations>
|
18
|
</div>
|
19
|
</div>
|
20
|
`
|
21
|
})
|
22
|
export class OrganizationsPageComponent {
|
23
|
properties:EnvProperties;
|
24
|
public pageContents = null;
|
25
|
public divContents = null;
|
26
|
public communityId = null;
|
27
|
|
28
|
constructor ( private route: ActivatedRoute, private _router: Router,
|
29
|
private _meta: Meta, private _title: Title,
|
30
|
private helper: HelperService) {}
|
31
|
|
32
|
public ngOnInit() {
|
33
|
this.route.data
|
34
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
35
|
this.properties = data.envSpecific;
|
36
|
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
37
|
this.updateUrl(data.envSpecific.baseLink+this._router.url);
|
38
|
this.updateTitle("Organizations");
|
39
|
this.updateDescription("Organizations, open access");
|
40
|
//this.getDivContents();
|
41
|
this.getPageContents();
|
42
|
});
|
43
|
}
|
44
|
|
45
|
private updateDescription(description:string){
|
46
|
this._meta.updateTag({content:description},"name='description'");
|
47
|
this._meta.updateTag({content:description},"property='og:description'");
|
48
|
}
|
49
|
private updateTitle(title:string){
|
50
|
var _prefix ="OpenAIRE | ";
|
51
|
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
|
52
|
this._title.setTitle(_title);
|
53
|
this._meta.updateTag({content:_title},"property='og:title'");
|
54
|
}
|
55
|
private updateUrl(url:string){
|
56
|
this._meta.updateTag({content:url},"property='og:url'");
|
57
|
}
|
58
|
|
59
|
private getPageContents() {
|
60
|
this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
|
61
|
this.pageContents = contents;
|
62
|
})
|
63
|
}
|
64
|
|
65
|
private getDivContents() {
|
66
|
this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
|
67
|
this.divContents = contents;
|
68
|
})
|
69
|
}
|
70
|
}
|