[Connect]: featured/featuredPage.component.ts & featured/featuredPage.module.ts & featured/featuredPage-routing.module.ts: Added files for loading custom, gateway specific pages | app-routing.module.ts: Added commented route resolving for loading custom, gateway specific pages.

This commit is contained in:
Konstantina Galouni 2022-12-07 12:48:47 +02:00
parent 19a012f578
commit 59c0a3552c
5 changed files with 123 additions and 8 deletions

View File

@ -38,13 +38,39 @@ const routes: Routes = [
loadChildren: () => import('./htmlPages/nationalBulletins/nationalBulletinsPage.module').then(m => m.NaionalBulletinPageModule), loadChildren: () => import('./htmlPages/nationalBulletins/nationalBulletinsPage.module').then(m => m.NaionalBulletinPageModule),
canActivate: [IsCommunity] canActivate: [IsCommunity]
}, },
{path: 'curators', loadChildren: () => import('./curators/curators.module').then(m => m.CuratorsModule), canActivate: [IsCommunity]}, // {
{path: 'subjects', loadChildren: () => import('./subjects/subjects.module').then(m => m.SubjectsModule), canActivate: [IsCommunity]}, // path: 'featured',
{path: 'myCommunities', loadChildren: () => import('./my-communities/my-communities.module').then(m => m.MyCommunitiesModule)}, // children: [
{ // {
path: 'develop', // path: '',
loadChildren: () => import('./develop/develop.module').then(m => m.DevelopModule), canActivate: [IsCommunity] // loadChildren: () => import('./htmlPages/featured/featuredPage.module').then(m => m.FeaturedPageModule),
}, // canActivateChild: [IsCommunity],
// },
// {
// path: '**',
// loadChildren: () => import('./htmlPages/featured/featuredPage.module').then(m => m.FeaturedPageModule),
// canActivateChild: [IsCommunity],
// },
// ]
// },
{
path: 'curators',
loadChildren: () => import('./curators/curators.module').then(m => m.CuratorsModule),
canActivate: [IsCommunity]
},
{
path: 'subjects',
loadChildren: () => import('./subjects/subjects.module').then(m => m.SubjectsModule),
canActivate: [IsCommunity]
},
{
path: 'myCommunities',
loadChildren: () => import('./my-communities/my-communities.module').then(m => m.MyCommunitiesModule)
},
{
path: 'develop',
loadChildren: () => import('./develop/develop.module').then(m => m.DevelopModule), canActivate: [IsCommunity]
},
/** Testing Page for help contents */ /** Testing Page for help contents */
{path: 'helper-test', loadChildren: () => import('./helper-test/helper-test.module').then(m => m.HelperTestModule)}, {path: 'helper-test', loadChildren: () => import('./helper-test/helper-test.module').then(m => m.HelperTestModule)},
/** Landing Pages */ /** Landing Pages */

View File

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

View File

@ -0,0 +1,41 @@
import {Component} from '@angular/core';
import {Router} from "@angular/router";
import {Subscription} from "rxjs";
import {ConfigurationService} from "../../openaireLibrary/utils/configuration/configuration.service";
import {Portal} from "../../openaireLibrary/utils/entities/adminTool/portal";
import {Page} from "../../openaireLibrary/utils/entities/adminTool/page";
@Component({
selector: 'featured',
template: `
<div class="uk-container uk-container-large uk-section uk-section-small uk-padding-remove-bottom">
<!-- <div class="uk-padding-small uk-padding-remove-horizontal">-->
<!-- <breadcrumbs [breadcrumbs]="breadcrumbs"></breadcrumbs>-->
<!-- </div>-->
<html-page [description]="page ? page.name : 'Featured'" [pageTitle]="page ? page.name : 'Featured'"></html-page>
</div>
`
})
export class FeaturedPageComponent {
// public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'about - National Bulletins'}];
public page: Page;
subs: Subscription[] = [];
constructor(private config: ConfigurationService, private _router: Router) {
}
ngOnInit() {
this.subs.push(this.config.communityInformationState.subscribe((portal: Portal) => {
if (portal) {
let pages: Page[] = <Page[]>portal.pages;
this.page = pages.find(page => (page.route == this._router.url));
}
}));
}
ngOnDestroy() {
for (let sub of this.subs) {
sub.unsubscribe();
}
}
}

View File

@ -0,0 +1,27 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {FeaturedPageComponent} from './featuredPage.component';
import {CommonModule} from "@angular/common";
import {HtmlPagesModule} from "../htmlPages.module";
import {FeaturedPageRoutingModule} from "./featuredPage-routing.module";
import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard";
import {BreadcrumbsModule} from "../../openaireLibrary/utils/breadcrumbs/breadcrumbs.module";
@NgModule({
imports: [
FeaturedPageRoutingModule, RouterModule, CommonModule, HtmlPagesModule, BreadcrumbsModule
],
declarations: [
FeaturedPageComponent
],
providers: [PreviousRouteRecorder, IsRouteEnabled],
exports: [
FeaturedPageComponent
]
})
export class FeaturedPageModule {
}

@ -1 +1 @@
Subproject commit fb1d7149654415dd6b848b86ab5187401f50975e Subproject commit 143c2719ec972c8456817c7c1dd17f96593eeddf