[Connect | master]: Added FoS and SDGs pages in Community Gateways | Bug fixes in piwik siteIds.

1. app.component.ts: Added MenuItems for Fields of Science and Sustainable Development Goals.
2. app-routing.module.ts: Added routing paths for /sdgs and /fields-of-science.
3. /fos & /sdgs: Added folders and files for new SDGs and FoS pages.
4. piwikHelper.ts: Added piwik for "egrise", "euconexus", "dth".
5. affiliations.component.ts: [Bug fix] Comment piwik track call (this component is called with/in other pages that are already tracked).
6. htmlPage.component.ts: [Bug fix] Get piwik siteId from PiwikHelper (TODO: Should get it by API).
This commit is contained in:
Konstantina Galouni 2023-04-21 15:09:22 +03:00
parent 8da98e7959
commit e6e9e06dfa
11 changed files with 176 additions and 15 deletions

View File

@ -53,7 +53,7 @@ export class AffiliationsComponent {
this.properties = properties;
if(this.longView) {
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId)).subscribe());
// this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId)).subscribe());
}
this.url = this.properties.domain + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url);

View File

@ -10,14 +10,27 @@ const routes: Routes = [
{path: 'my-orcid-links', loadChildren: () => import('./orcid/my-orcid-links/myOrcidLinks.module').then(m => m.LibMyOrcidLinksModule)},
/** Other Pages */
{path: '', loadChildren: () => import('./communitywrapper/communityWrapper.module').then(m => m.CommunityWrapperModule)},
{
path: '',
loadChildren: () => import('./communitywrapper/communityWrapper.module').then(m => m.CommunityWrapperModule)
},
{path: 'about', redirectTo: 'about/learn-how', pathMatch: 'full'},
{path: 'about/learn-how', loadChildren: () => import('./learn-how/learn-how.module').then(m => m.LearnHowModule)},
{path: 'about/faq', loadChildren: () => import('./learn-how/faqs/faqs.module').then(m => m.FaqsModule)},
{path: 'get-started', loadChildren: () => import('./get-started/get-started.module').then(m => m.GetStartedModule)},
{path: 'contact-us', loadChildren: () => import('./contact/contact.module').then(m => m.ContactModule)},
{path: 'invite', loadChildren: () => import('./utils/subscribe/invite/invite.module').then(m => m.InviteModule)},
{path: 'content', loadChildren: () => import('./content/contentPage.module').then(m => m.ContentPageModule), canActivate: [IsCommunity]},
{
path: 'content',
loadChildren: () => import('./content/contentPage.module').then(m => m.ContentPageModule),
canActivate: [IsCommunity]
},
{path: 'sdgs', loadChildren: () => import('./sdg/sdg.module').then(m => m.LibSdgModule)},
{
path: 'fields-of-science',
loadChildren: () => import('./fos/fos.module').then(m => m.LibFosModule),
data: {extraOffset: 100}
},
{
path: 'organizations',
loadChildren: () => import('./htmlPages/organizations/organizationsPage.module').then(m => m.OrganizationsPageModule),

View File

@ -377,6 +377,8 @@ export class AppComponent implements OnInit, OnDestroy {
new MenuItem("", "National Bulletins", "", "/national-bulletins", false, [], ["/national-bulletins"], {}),
new MenuItem("", "Subjects", "", "/subjects", false, [], ["/subjects"], {}),
new MenuItem("", "Projects and funding Opportunities", "", "/projects", false, [], ["/projects"], {}),
new MenuItem("", "Fields of Science", "", "/fields-of-science", false, [], ["/fields-of-science"], {}),
new MenuItem("", "Sustainable Development Goals", "", "/sdgs", false, [], ["/sdgs"], {}),
]
));
this.menuItems.push(

View File

@ -0,0 +1,20 @@
import {NgModule} from "@angular/core";
import {RouterModule} from "@angular/router";
import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
import {CommunityFosComponent} from "./fos.component";
import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard";
@NgModule({
imports: [
RouterModule.forChild([
{
path: '',
component: CommunityFosComponent,
canActivate: [IsRouteEnabled],
canDeactivate: [PreviousRouteRecorder]
}
])
]
})
export class LibFosRoutingModule {
}

View File

@ -0,0 +1,24 @@
import {Component} from "@angular/core";
import {properties} from "../../environments/environment";
import {ConnectHelper} from "../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../utils/piwikHelper";
@Component({
selector: 'community-fos',
template: `
<fos [piwikSiteId]="piwikSiteId"></fos>
`
})
export class CommunityFosComponent {
piwikSiteId;
communityId;
constructor() {
}
ngOnInit() {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId);
}
}

27
src/app/fos/fos.module.ts Normal file
View File

@ -0,0 +1,27 @@
import {CommonModule} from "@angular/common";
import {NgModule} from "@angular/core";
import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
import {LibFosRoutingModule} from "./fos-routing.module";
import {FosRoutingModule} from "../openaireLibrary/fos/fos-routing.module";
import {FosModule} from "../openaireLibrary/fos/fos.module";
import {CommunityFosComponent} from "./fos.component";
@NgModule({
imports: [
CommonModule,
LibFosRoutingModule,
FosRoutingModule,
FosModule
],
declarations: [
CommunityFosComponent
],
exports: [
CommunityFosComponent
],
providers: [
PreviousRouteRecorder
]
})
export class LibFosModule {
}

View File

@ -8,6 +8,7 @@ import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
import {ConnectHelper} from "../openaireLibrary/connect/connectHelper";
import {Subscriber} from "rxjs";
import {properties} from "../../environments/environment";
import {PiwikHelper} from "../utils/piwikHelper";
@Component({
selector: 'html-page',
@ -21,26 +22,28 @@ export class HtmlPageComponent {
properties: EnvProperties = properties;
public pageContents = null;
public divContents = null;
@Input() url: string = null;
@Input() pageTitle: string;
@Input() description: string;
private subscriptions = [];
communityId;
constructor(private route: ActivatedRoute, private _router: Router,
piwikSiteId;
constructor(private route: ActivatedRoute, private _router: Router,
private _meta: Meta,
private _title: Title,
private seoService: SEOService,
private _piwikService: PiwikService,
private helper: HelperService) {
}
public ngOnInit() {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId);
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe());
}
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
//TODO set the proper URL
this.url = this.properties.domain + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url);

View File

@ -0,0 +1,20 @@
import {NgModule} from "@angular/core";
import {RouterModule} from "@angular/router";
import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
import {CommunitySdgComponent} from "./sdg.component";
import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard";
@NgModule({
imports: [
RouterModule.forChild([
{
path: '',
component: CommunitySdgComponent,
canActivate: [IsRouteEnabled],
canDeactivate: [PreviousRouteRecorder]
}
])
]
})
export class LibSdgRoutingModule {
}

View File

@ -0,0 +1,23 @@
import {Component} from "@angular/core";
import {properties} from "../../environments/environment";
import {ConnectHelper} from "../openaireLibrary/connect/connectHelper";
import {PiwikHelper} from "../utils/piwikHelper";
@Component({
selector: 'community-sdg',
template: `
<sdg [piwikSiteId]="piwikSiteId"></sdg>
`
})
export class CommunitySdgComponent {
piwikSiteId;
communityId;
constructor() {
}
ngOnInit() {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId);
}
}

27
src/app/sdg/sdg.module.ts Normal file
View File

@ -0,0 +1,27 @@
import {CommonModule} from "@angular/common";
import {NgModule} from "@angular/core";
import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
import {LibSdgRoutingModule} from "./sdg-routing.module";
import {SdgRoutingModule} from "../openaireLibrary/sdg/sdg-routing.module";
import {SdgModule} from "../openaireLibrary/sdg/sdg.module";
import {CommunitySdgComponent} from "./sdg.component";
@NgModule({
imports: [
CommonModule,
LibSdgRoutingModule,
SdgRoutingModule,
SdgModule
],
declarations: [
CommunitySdgComponent
],
exports: [
CommunitySdgComponent
],
providers: [
PreviousRouteRecorder
]
})
export class LibSdgModule {
}

View File

@ -27,20 +27,22 @@ export class PiwikHelper{
"inspired-ris":530,
"citizen-science":538,
"eut":558,
"aurora":560,
"aurora": 560,
"ebrains": 592,
"neanias-space":604,
"heritage-science":607,
"eutopia":608,
"neanias-space": 604,
"heritage-science": 607,
"eutopia": 608,
"north-america-studies": 609,
"iperionhs":610,
"iperionhs": 610,
"neanias-atmospheric": 613,
"forthem": 625,
"argo-france": 634,
"knowmad": 640
"knowmad": 640,
"egrise": 710,
"euconexus": 707,
"dth": 719
};
public static getSiteId(communityId:string){
return this.siteIDs[communityId];
}
}