Select Git revision
app-routing.module.ts 6.58 KiB
import { NgModule } from '@angular/core';
import { Route, RouterModule, Routes } from '@angular/router';
import { AnnuaireComponent } from './annuaire/annuaire.component';
import { CartoComponent } from './carto/carto.component';
import { ContactComponent } from './contact/contact.component';
import { FooterComponent } from './footer/footer.component';
import { AdminGuard } from './guards/admin.guard';
import { AuthGuard } from './guards/auth.guard';
import { ResetPasswordTokenGuard } from './guards/resetPasswordToken.guard';
import { LegalNoticeComponent } from './legal-notice/legal-notice.component';
import { LoginComponent } from './login/login.component';
import { NewsletterSubscriptionComponent } from './newsletter-subscription/newsletter-subscription.component';
import { PageComponent } from './page/page.component';
import { ResetEmailComponent } from './reset-email/reset-email.component';
import { ForgotPasswordComponent } from './reset-password/forgot-password.component';
import { StructureResolver } from './resolvers/structure.resolver';
import { StructureDetailsComponent } from './structure-list/components/structure-details/structure-details.component';
import { StructureListSearchPrintComponent } from './structure-list/components/structure-list-search-print/structure-list-search-print.component';
import { StructureListComponent } from './structure-list/structure-list.component';
import { StructureJoinComponent } from './structure/structure-join/structure-join.component';
const footerOutletRoute: Route = {
path: '',
outlet: 'footer',
component: FooterComponent,
};
function buildTitle(pageTitle = ''): string {
let title = "Réseau des acteurs de l'inclusion numérique de la métropole de Lyon";
if (pageTitle) {
title = pageTitle + ' | ' + title;
}
return title;
}
const routes: Routes = [
{
path: 'print',
outlet: 'print',
children: [{ path: 'structures-search', component: StructureListSearchPrintComponent }],
},
{
path: 'acteurs',
title: buildTitle('Cartographie'),
runGuardsAndResolvers: 'always',
resolve: {
structure: StructureResolver,
},
children: [
{
path: '',
component: CartoComponent,
},
{
path: '',
outlet: 'left-pane',
component: StructureDetailsComponent,
},
],
},
{
path: 'connexion',
title: buildTitle('Connexion'),
children: [
{
path: '',
component: LoginComponent,
},
],
},
{
path: 'structures',
children: [
{
path: '',
component: StructureListComponent,
},
footerOutletRoute,
],
},
{
path: 'mentions-legales',
title: buildTitle('Mentions légales'),
children: [
{
path: '',
component: LegalNoticeComponent,
},
footerOutletRoute,
],
},
{
path: 'page/:slugPage',
title: buildTitle(),
children: [
{
path: '',
component: PageComponent,
},
footerOutletRoute,
],
},
{
path: 'contact',
title: buildTitle('Contact'),
children: [
{
path: '',
component: ContactComponent,
},
footerOutletRoute,
],
},
{
path: 'users/verify/:id',
children: [
{
path: '',
component: LoginComponent,
},
],
},
{
path: 'change-email/:id',
children: [
{
path: '',
component: ResetEmailComponent,
},
footerOutletRoute,
],
},
{
path: 'profil',
title: buildTitle('Profil'),
children: [
{
path: '',
canActivate: [AuthGuard],
loadChildren: () => import('./profile/profile.module').then((m) => m.ProfileModule),
},
{
path: '',
outlet: 'left-pane',
data: { fullScreen: true },
runGuardsAndResolvers: 'always',
component: StructureDetailsComponent,
resolve: {
structure: StructureResolver,
},
},
],
},
{
path: 'join-request/:permalink',
children: [
{
path: '',
canActivate: [AuthGuard],
component: StructureJoinComponent,
resolve: {
structure: StructureResolver,
},
},
],
},
{
path: 'join-validation',
children: [
{
path: '',
canActivate: [AuthGuard],
component: StructureJoinComponent,
resolve: {
structure: StructureResolver,
},
},
],
},
{
path: 'mot-de-passe-oublie',
children: [
{
path: '',
canActivate: [ResetPasswordTokenGuard],
component: ForgotPasswordComponent,
},
],
},
{
path: 'newsletter',
title: buildTitle('Newsletter'),
children: [
{
path: '',
component: NewsletterSubscriptionComponent,
},
footerOutletRoute,
],
},
{
path: 'desabonnement-newsletter',
children: [
{
path: '',
component: NewsletterSubscriptionComponent,
},
footerOutletRoute,
],
},
{
path: 'annuaire',
title: buildTitle('Annuaire'),
children: [
{
path: '',
component: AnnuaireComponent,
},
footerOutletRoute,
],
},
{
path: 'actualites',
title: buildTitle('Actualités'),
children: [
{
path: '',
loadChildren: () => import('./post/post.module').then((m) => m.PostModule),
},
footerOutletRoute,
],
},
{
path: 'admin',
title: buildTitle('Admin'),
children: [
{
path: '',
canActivate: [AdminGuard],
loadChildren: () => import('./admin/admin.module').then((m) => m.AdminModule),
},
],
},
{
path: 'formulaire',
title: buildTitle(),
loadChildren: () => import('./form/form-view/form-view.module').then((m) => m.FormViewModule),
},
{
path: 'orientation',
title: buildTitle('Orientation'),
runGuardsAndResolvers: 'always',
resolve: {
structure: StructureResolver,
},
children: [
{
path: '',
loadChildren: () => import('./form/orientation-form-view/orientation.module').then((m) => m.OrientationModule),
},
{
path: '',
outlet: 'left-pane',
data: { fullScreen: true, meeting: false },
component: StructureDetailsComponent,
},
],
},
{
path: 'home',
redirectTo: 'actualites',
},
{
path: '**',
redirectTo: 'actualites',
},
];
@NgModule({
imports: [
RouterModule.forRoot(routes, {
anchorScrolling: 'enabled',
}),
],
exports: [RouterModule],
})
export class AppRoutingModule {}