110 lines
6.1 KiB
TypeScript
110 lines
6.1 KiB
TypeScript
import {Component, Input, OnInit} from '@angular/core';
|
|
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
|
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
|
import {ActivatedRoute} from '@angular/router';
|
|
import {EnvironmentSpecificService} from '../../openaireLibrary/utils/properties/environment-specific.service';
|
|
import {CommunitiesService} from '../../openaireLibrary/connect/communities/communities.service';
|
|
import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo';
|
|
import {HelperFunctions} from '../../openaireLibrary/utils/HelperFunctions.class';
|
|
|
|
@Component({
|
|
selector: 'wellcome',
|
|
template: `
|
|
<div class="image-front-topbar wellcomePage uk-background-norepeat uk-background-cover uk-background-top-center uk-section uk-padding-remove-bottom" uk-scrollspy="{"target":"[uk-scrollspy-class]","cls":"uk-animation-fade","delay":false}" tm-header-transparent="light" tm-header-transparent-placeholder=""
|
|
uk-height-viewport="offset-top: true">
|
|
<div *ngIf="communities.length == 0" class="uk-container uk-container-large uk-section uk-margin-large-top">
|
|
<div class="uk-width-2-5@m uk-width-1-1@s">
|
|
<h1 class="font-41">A <b>Science Gateway</b> to the future of your <b>Community</b></h1>
|
|
<div class="uk-text-large">Turn Open Science into Practice. It takes your open and linked research outcomes. A service
|
|
customized to your needs.
|
|
</div>
|
|
</div>
|
|
<div class="uk-width-1-1 uk-inline uk-margin-large-top uk-margin-large-bottom">
|
|
<a class="uk-button portal-button" href="https://beta.connect.openaire.eu/about"> LEARN
|
|
HOW</a>
|
|
</div>
|
|
</div>
|
|
<div *ngIf="communities.length > 0" class="uk-container uk-container-large uk-section">
|
|
<div class="uk-container">
|
|
<div class="uk-grid-match uk-grid-small uk-child-width-1-4@m uk-child-width-1-2@s uk-child-width-1-1@xs
|
|
uk-text-center" uk-grid>
|
|
<div *ngFor="let community of communities;">
|
|
<div class="uk-padding-small uk-height-max-medium uk-card uk-card-default communityCard">
|
|
<div class="uk-container" *ngIf="community">
|
|
<div class="uk-card-media-top uk-margin-top uk-padding-small">
|
|
<a [queryParams]="{communityId: community.communityId}" routerLinkActive="router-link-active"
|
|
routerLink="/dashboard">
|
|
<div style="" class="uk-margin-auto communitiesImageBox">
|
|
<div class="communitiesImageBox uk-position-relative uk-align-center">
|
|
<img *ngIf= "community.logoUrl != null && community.logoUrl != '' " src="{{community.logoUrl}}" alt="{{(community.title)?community.title:community.shortTitle}} logo" class="uk-position-center">
|
|
<span *ngIf= "community.logoUrl == null || community.logoUrl == '' "class="uk-icon uk-position-center">
|
|
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="2.5"> <circle fill="none" stroke="#000" stroke-width="1.1" cx="7.7" cy="8.6" r="3.5"></circle> <path fill="none" stroke="#000" stroke-width="1.1" d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3"></path> <path fill="none" stroke="#000" stroke-width="1.1" d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1"></path></svg>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div class="uk-margin-top">
|
|
<div class="uk-text-center">
|
|
<p class="uk-text-small uk-text-bold uk-margin-small uk-margin-small-top community-title">
|
|
<a>
|
|
<span class="uk-text-small uk-margin-small" *ngIf="community.title">
|
|
{{community.title}}
|
|
</span>
|
|
<span class="uk-text-small uk-margin-small" *ngIf="!community.title && community.shortTitle">
|
|
{{community.shortTitle}}
|
|
</span>
|
|
</a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
`
|
|
})
|
|
|
|
export class WellcomeComponent implements OnInit {
|
|
properties: EnvProperties = null;
|
|
public communities: CommunityInfo[] = [];
|
|
|
|
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService, private _communitiesService: CommunitiesService) {
|
|
}
|
|
|
|
ngOnInit() {
|
|
this.propertiesService.loadEnvironment().then(es => {
|
|
this.propertiesService.setEnvProperties(es);
|
|
this.properties = this.propertiesService.envSpecific;
|
|
HelperFunctions.scroll();
|
|
|
|
//this._communitiesService.getCommunities(this.properties, this.properties.communityAPI + 'communities').subscribe(
|
|
this._communitiesService.getCommunitiesState().subscribe(
|
|
communities => {
|
|
var countCommunities = 0;
|
|
var index_managerOfCommunity = null;
|
|
for (var i = 0; i < communities.length; i++) {
|
|
var com = communities[i];
|
|
if (Session.isPortalAdministrator() || Session.isCommunityCurator()) {
|
|
this.communities.push(communities[i]);
|
|
} else {
|
|
for (var manager of com.managers) {
|
|
if (manager == Session.getUserEmail()) {
|
|
countCommunities++;
|
|
index_managerOfCommunity = i;
|
|
this.communities.push(communities[i]);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|