From 526764136393b2adb904aaabd412850318962698 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Fri, 7 Jun 2019 13:03:33 +0000 Subject: [PATCH] [Trunk | Connect]: affiliations.component: Component to show affiliations (used by community page, curators page, organizations page). git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@56029 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../affiliations/affiliations.component.html | 95 +++++++++++++++++++ .../affiliations/affiliations.component.ts | 53 +++++++++++ src/app/affiliations/affiliations.module.ts | 25 +++++ src/app/community/community.component.html | 4 +- src/app/community/community.module.ts | 3 +- src/app/curators/curators.component.html | 47 ++------- src/app/curators/curators.module.ts | 3 +- .../organizationsPage.component.ts | 7 +- .../organizations/organizationsPage.module.ts | 3 +- 9 files changed, 194 insertions(+), 46 deletions(-) create mode 100644 src/app/affiliations/affiliations.component.html create mode 100644 src/app/affiliations/affiliations.component.ts create mode 100644 src/app/affiliations/affiliations.module.ts diff --git a/src/app/affiliations/affiliations.component.html b/src/app/affiliations/affiliations.component.html new file mode 100644 index 0000000..857498f --- /dev/null +++ b/src/app/affiliations/affiliations.component.html @@ -0,0 +1,95 @@ + + +
+ {{organization.name.slice(0,100)}}... +
+
+ + +
+ +
+
+ + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ + diff --git a/src/app/affiliations/affiliations.component.ts b/src/app/affiliations/affiliations.component.ts new file mode 100644 index 0000000..8e3fbc2 --- /dev/null +++ b/src/app/affiliations/affiliations.component.ts @@ -0,0 +1,53 @@ +import {Component, Input} 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 {AffiliationService} from "../openaireLibrary/connect/affiliations/affiliation.service"; +import {Affiliation} from "../openaireLibrary/utils/entities/CuratorInfo"; +import {ConnectHelper} from "../openaireLibrary/connect/connectHelper"; + +@Component({ + selector: 'affiliations', + templateUrl: './affiliations.component.html' +}) +export class AffiliationsComponent { + @Input() getAffiliationsFromAPI: boolean = false; + @Input() fullView: boolean = false; + @Input() affiliationsInSlider: number = 5; + @Input() affiliations: Affiliation[] = []; + + communityId: string; + properties:EnvProperties; + + constructor ( private route: ActivatedRoute, private _router: Router, + private _meta: Meta, private _title: Title, + private affiliationService: AffiliationService) {} + + public ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.route.queryParams.subscribe( + communityId => { + this.communityId = communityId['communityId']; + if(!this.communityId){ + this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); + } + + this.properties = data.envSpecific; + + if(this.getAffiliationsFromAPI) { + console.info("onInit: before affiliations"); + this.affiliationService.initAffiliations(this.properties, this.properties.communityAPI + this.communityId + "/organizations"); + this.affiliationService.affiliations.subscribe( + affiliations => { + this.affiliations = affiliations; + }, + error => { + console.error("Affiliations Component: Error getting affiliations for community with id: "+this.communityId, error); + } + ); + } + }); + }); + } +} diff --git a/src/app/affiliations/affiliations.module.ts b/src/app/affiliations/affiliations.module.ts new file mode 100644 index 0000000..a40e592 --- /dev/null +++ b/src/app/affiliations/affiliations.module.ts @@ -0,0 +1,25 @@ +import { NgModule, ModuleWithProviders } from '@angular/core'; + +import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard'; +import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import {IsRouteEnabled} from '../openaireLibrary/error/isRouteEnabled.guard' + +import {AffiliationsComponent} from './affiliations.component'; +import {AffiliationService} from "../openaireLibrary/connect/affiliations/affiliation.service"; +import {CommonModule} from "@angular/common"; + +@NgModule({ + imports: [ + CommonModule + ], + declarations: [ + AffiliationsComponent + ], + providers:[FreeGuard,PreviousRouteRecorder, IsRouteEnabled, AffiliationService], + exports: [ + AffiliationsComponent + ] +}) + + +export class AffiliationsModule{} diff --git a/src/app/community/community.component.html b/src/app/community/community.component.html index bc73fdd..1f94e03 100644 --- a/src/app/community/community.component.html +++ b/src/app/community/community.component.html @@ -323,10 +323,10 @@ -
+
- Related Organizations.... +
diff --git a/src/app/community/community.module.ts b/src/app/community/community.module.ts index eed6979..85f4ac5 100644 --- a/src/app/community/community.module.ts +++ b/src/app/community/community.module.ts @@ -22,13 +22,14 @@ import {SearchDataprovidersServiceModule} from "../openaireLibrary/connect/conte import {SearchProjectsServiceModule} from '../openaireLibrary/connect/projects/searchProjectsService.module'; import {SearchResearchResultsServiceModule} from "../openaireLibrary/services/searchResearchResultsService.module"; import {SearchResultsModule} from "../openaireLibrary/searchPages/searchUtils/searchResults.module"; +import {AffiliationsModule} from "../affiliations/affiliations.module"; @NgModule({ imports: [ CommonModule, FormsModule, RouterModule, SubscribeModule, StatisticsModule, ManageModule, InviteModule, SearchZenodoCommunitiesServiceModule, ZenodoCommunitiesServiceModule, SearchFormModule, SearchDataprovidersServiceModule, SearchProjectsServiceModule, - SearchResearchResultsServiceModule, SearchResultsModule + SearchResearchResultsServiceModule, SearchResultsModule, AffiliationsModule ], declarations: [ diff --git a/src/app/curators/curators.component.html b/src/app/curators/curators.component.html index da7e93c..a7a70e1 100644 --- a/src/app/curators/curators.component.html +++ b/src/app/curators/curators.component.html @@ -8,12 +8,13 @@
-

+

Curators ({{curators.length}})

-
+
+
@@ -25,52 +26,22 @@
-
+ + +
-
Affiliations
+
+
Affiliations
-
- - - -
-
- -
+
diff --git a/src/app/curators/curators.module.ts b/src/app/curators/curators.module.ts index 2075d2e..9798eaa 100644 --- a/src/app/curators/curators.module.ts +++ b/src/app/curators/curators.module.ts @@ -6,11 +6,12 @@ import { RouterModule } from '@angular/router'; import {CuratorsComponent} from './curators.component'; import {CuratorService} from "../openaireLibrary/connect/curators/curator.service"; import {CuratorsRoutingModule} from "./curators-routing.module"; +import {AffiliationsModule} from "../affiliations/affiliations.module"; @NgModule({ imports: [ CommonModule, FormsModule, RouterModule, - CuratorsRoutingModule + CuratorsRoutingModule, AffiliationsModule ], declarations: [ CuratorsComponent diff --git a/src/app/htmlPages/organizations/organizationsPage.component.ts b/src/app/htmlPages/organizations/organizationsPage.component.ts index 5fbe4df..01ddc8e 100644 --- a/src/app/htmlPages/organizations/organizationsPage.component.ts +++ b/src/app/htmlPages/organizations/organizationsPage.component.ts @@ -10,6 +10,7 @@ import{EnvProperties} from '../../openaireLibrary/utils/properties/env-propertie
+
` @@ -23,9 +24,9 @@ export class OrganizationsPageComponent { public ngOnInit() { this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { - this.updateUrl(data.envSpecific.baseLink+this._router.url); - this.updateTitle("Organizations"); - this.updateDescription("Organizations, open access"); + this.updateUrl(data.envSpecific.baseLink+this._router.url); + this.updateTitle("Organizations"); + this.updateDescription("Organizations, open access"); }); } diff --git a/src/app/htmlPages/organizations/organizationsPage.module.ts b/src/app/htmlPages/organizations/organizationsPage.module.ts index b42e5a2..129a9d3 100644 --- a/src/app/htmlPages/organizations/organizationsPage.module.ts +++ b/src/app/htmlPages/organizations/organizationsPage.module.ts @@ -8,10 +8,11 @@ import {OrganizationsPageComponent} from './organizationsPage.component'; import {OrganizationsPageRoutingModule} from './organizationsPage-routing.module'; import {HtmlPagesModule} from '../htmlPages.module'; +import {AffiliationsModule} from "../../affiliations/affiliations.module"; @NgModule({ imports: [ - OrganizationsPageRoutingModule, HtmlPagesModule + OrganizationsPageRoutingModule, HtmlPagesModule, AffiliationsModule ], declarations: [ OrganizationsPageComponent