diff --git a/connect/components/curators/curators-routing.module.ts b/connect/components/curators/curators-routing.module.ts new file mode 100644 index 00000000..39c74dd6 --- /dev/null +++ b/connect/components/curators/curators-routing.module.ts @@ -0,0 +1,15 @@ +import { NgModule} from '@angular/core'; +import { RouterModule } from '@angular/router'; +import {CuratorsComponent} from "./curators.component"; +import {IsRouteEnabled} from "../../../error/isRouteEnabled.guard"; +import {PreviousRouteRecorder} from "../../../utils/piwik/previousRouteRecorder.guard"; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: CuratorsComponent, canActivate: [IsRouteEnabled], canDeactivate: [PreviousRouteRecorder]} + ]) + ] +}) +export class CuratorsRoutingModule { +} diff --git a/connect/components/curators/curators.component.html b/connect/components/curators/curators.component.html new file mode 100644 index 00000000..6298a533 --- /dev/null +++ b/connect/components/curators/curators.component.html @@ -0,0 +1,152 @@ + + +
+
+
+ +
+
+
+
+ +
+
+

+ Curators +

+
+ + +
+
+
+
+
+
+ Curator Photo + Curator Photo +
+
+
+

{{curator.name}}

+
+
+ Biography +
+
+
{{format(curator.bio)}}
+
{{curator.bio}}
+ +
+
+
+
+
+
+
+ Affiliations +
+
+
+ + + + + + +
+
+
+
+
+
+
+
+ + +
+
+
+
+ + + +
+ + Curated by: + + +
+
+ +
+
+
+
+

+ {{curatorInModal.name}} +

+ Curator Photo + Curator Photo +
+
+ +
    +
  • +
    + Biography +
    +
    + {{curatorInModal.bio}} +
    +
  • +
  • +
    +
    + + + + + + +
    +
    +
  • +
+
+
+
+
+
diff --git a/connect/components/curators/curators.component.ts b/connect/components/curators/curators.component.ts new file mode 100644 index 00000000..4423168f --- /dev/null +++ b/connect/components/curators/curators.component.ts @@ -0,0 +1,155 @@ +import {Component, Input, ViewChild} from '@angular/core'; +import {EnvProperties} from '../../../utils/properties/env-properties'; +import {CuratorService} from "../../curators/curator.service"; +import {Curator} from "../../../utils/entities/CuratorInfo"; +import {ActivatedRoute, Router} from "@angular/router"; +import {CommunityService} from "../../community/community.service"; +import {HelperService} from "../../../utils/helper/helper.service"; +import {Meta, Title} from "@angular/platform-browser"; +import {SEOService} from "../../../sharedComponents/SEO/SEO.service"; +import {PiwikService} from "../../../utils/piwik/piwik.service"; +import {Breadcrumb} from "../../../utils/breadcrumbs/breadcrumbs.component"; +import {Subscription} from "rxjs"; +import {properties} from "../../../../../environments/environment"; +import {UserRegistryService} from "../../../services/user-registry.service"; +import {FullScreenModalComponent} from '../../../utils/modal/full-screen-modal/full-screen-modal.component'; +import {CommunityInfo} from "../../community/communityInfo"; + +@Component({ + selector: 'curators', + templateUrl: './curators.component.html' + +}) +export class CuratorsComponent { + @Input() longView = true; + community: CommunityInfo; + public downloadUrl = null; + public showLoading = true; + + public curators: Curator[] = []; + + public curatorsLimit: number = 5; + public numberOfCurators: number = 5; + + public showMore = []; + public maxCharacters = 450; + public viewingMore: boolean = false; + public curatorInModal; + + public properties: EnvProperties; + public pageContents = null; + public divContents = null; + + public url: string = null; + public pageTitle: string = "Curators"; + + public breadcrumbs: Breadcrumb[] = [{name: 'Home', route: '/'}, {name: 'About - Curators'}]; + + subs: Subscription[] = []; + + @ViewChild('fsModal', { static: true }) fsModal: FullScreenModalComponent; + + constructor(private route: ActivatedRoute, + private curatorsService: CuratorService, + private communityService: CommunityService, + private userRegistryService: UserRegistryService, + private _router: Router, + private helper: HelperService, + private _meta: Meta, + private _title: Title, + private seoService: SEOService, + private _piwikService: PiwikService) { + } + + ngOnInit() { + this.showLoading = true; + this.properties = properties; + this.downloadUrl = this.properties.utilsService + '/download/'; + //if (properties.environment !== 'development') { + if (!this.longView) { + this.subs.push(this.communityService.getCommunityAsObservable().subscribe(community => { + if (community) { + this.community = community; + this.getCurators(); + } + })); + } else { + this.subs.push(this.communityService.getCommunityAsObservable().subscribe(community => { + if (community) { + this.community = community; + this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe()); + this.url = this.properties.domain + this._router.url; + this.seoService.createLinkForCanonicalURL(this.url); + this.updateUrl(this.url); + this.updateTitle(this.pageTitle); + this.updateDescription("OpenAIRE - Connect, Community Gateway, research community"); + //this.getDivContents(); + this.getPageContents(); + this.getCurators(); + } + })); + } + } + + ngOnDestroy() { + for (let sub of this.subs) { + sub.unsubscribe(); + } + } + + private getCurators() { + this.subs.push(this.curatorsService.getCurators(this.properties, this.community.communityId).subscribe(curators => { + this.curators = curators; + this.showLoading = false; + }, error => { + console.error(error); + this.curators = []; + this.showLoading = false; + })); + } + + private getPageContents() { + this.subs.push(this.helper.getPageHelpContents(this.properties, this.community.communityId, this._router.url).subscribe(contents => { + this.pageContents = contents; + })); + } + + private getDivContents() { + this.subs.push(this.helper.getDivHelpContents(this.properties, this.community.communityId, this._router.url).subscribe(contents => { + this.divContents = contents; + })); + } + + format(name: string) { + if (name) { + return (((name).length > this.maxCharacters) ? (name.substring(0, (this.maxCharacters - ('...').length)) + '...') : name); + } else { + return null; + } + } + + public viewMore() { + this.viewingMore = !this.viewingMore; + } + + public openFsModal(curator) { + this.curatorInModal = curator; + this.fsModal.title = this.community.shortTitle + ' Curator'; + this.fsModal.open(); + } + + private updateDescription(description: string) { + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); + } + + private updateTitle(title: string) { + var _title = ((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'"); + } +} diff --git a/connect/components/curators/curators.module.ts b/connect/components/curators/curators.module.ts new file mode 100644 index 00000000..dc5f4530 --- /dev/null +++ b/connect/components/curators/curators.module.ts @@ -0,0 +1,35 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { RouterModule } from '@angular/router'; + +import {CuratorsComponent} from './curators.component'; +import {CuratorService} from "../../curators/curator.service"; +import {CuratorsRoutingModule} from "./curators-routing.module"; +import {AffiliationsModule} from "../../../../affiliations/affiliations.module"; +import {HelperModule} from "../../../utils/helper/helper.module"; +import {Schema2jsonldModule} from "../../../sharedComponents/schema2jsonld/schema2jsonld.module"; +import {SEOServiceModule} from "../../../sharedComponents/SEO/SEOService.module"; +import {PiwikServiceModule} from "../../../utils/piwik/piwikService.module"; +import {BreadcrumbsModule} from "../../../utils/breadcrumbs/breadcrumbs.module"; +import {UrlPrefixModule} from "../../../utils/pipes/url-prefix.module"; +import {LoadingModule} from '../../../utils/loading/loading.module'; +import {FullScreenModalModule} from '../../../utils/modal/full-screen-modal/full-screen-modal.module'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, RouterModule, + CuratorsRoutingModule, AffiliationsModule, HelperModule, + Schema2jsonldModule, SEOServiceModule, PiwikServiceModule, + BreadcrumbsModule, UrlPrefixModule, LoadingModule, + FullScreenModalModule + ], + declarations: [ + CuratorsComponent + ], + providers: [CuratorService], + exports: [ + CuratorsComponent + ] +}) +export class CuratorsModule {} diff --git a/dashboard/plugins/components/gateway-information/plugin-gateway-information.module.ts b/dashboard/plugins/components/gateway-information/plugin-gateway-information.module.ts index 93ce5be8..42fba1a2 100644 --- a/dashboard/plugins/components/gateway-information/plugin-gateway-information.module.ts +++ b/dashboard/plugins/components/gateway-information/plugin-gateway-information.module.ts @@ -9,7 +9,7 @@ import {IconsService} from "../../../../utils/icons/icons.service"; import {SearchResearchResultsServiceModule} from "../../../../services/searchResearchResultsService.module"; import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module"; import {PluginGatewayInformationComponent} from './plugin-gateway-information.component'; -import {CuratorsModule} from '../../../../../curators/curators.module'; +import {CuratorsModule} from '../../../../connect/components/curators/curators.module'; import {SearchCommunityProjectsService} from '../../../../../openaireLibrary/connect/projects/searchProjects.service'; import {SearchCommunityDataprovidersService} from '../../../../../openaireLibrary/connect/contentProviders/searchDataproviders.service'; import {ZenodoCommunitiesService} from '../../../../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';