Skip to content
Snippets Groups Projects
app-routing.module.ts 6.39 KiB
Newer Older
  • Learn to ignore specific revisions
  • Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    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,
    };
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
    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 = [
    
        children: [{ path: 'structures-search', component: StructureListSearchPrintComponent }],
    
        title: buildTitle('Cartographie'),
    
        children: [
          {
            path: '',
            component: CartoComponent,
          },
          {
            path: '',
            outlet: 'left-pane',
    
            component: StructureDetailsComponent,
    
            resolve: {
              structure: StructureResolver,
            },
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      },
      {
        path: 'login',
    
        title: buildTitle('Connexion'),
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      },
    
      {
        path: 'structures',
        children: [
          {
            path: '',
            component: StructureListComponent,
          },
          footerOutletRoute,
        ],
      },
    
      {
        path: 'legal-notice',
    
        title: buildTitle('Mentions légales'),
    
        children: [
          {
            path: '',
            component: LegalNoticeComponent,
          },
          footerOutletRoute,
        ],
    
        children: [
          {
            path: '',
            component: PageComponent,
          },
          footerOutletRoute,
        ],
    
      {
        path: 'contact',
    
        title: buildTitle('Contact'),
    
        children: [
          {
            path: '',
            component: ContactComponent,
          },
          footerOutletRoute,
        ],
    
      {
        path: 'users/verify/:id',
    
        children: [
          {
            path: '',
            component: ResetEmailComponent,
          },
          footerOutletRoute,
        ],
    
        title: buildTitle('Profil'),
    
        children: [
          {
            path: '',
            canActivate: [AuthGuard],
            loadChildren: () => import('./profile/profile.module').then((m) => m.ProfileModule),
          },
    
          {
            path: '',
            outlet: 'left-pane',
            data: { fullScreen: true },
    
            component: StructureDetailsComponent,
    
            resolve: {
              structure: StructureResolver,
            },
    
        path: 'join-request/:id',
        children: [
          {
            path: '',
            canActivate: [AuthGuard],
            component: StructureJoinComponent,
            resolve: {
              structure: StructureResolver,
            },
          },
        ],
      },
      {
        path: 'join-validation',
    
        children: [
          {
            path: '',
            canActivate: [AuthGuard],
            component: StructureJoinComponent,
    
            resolve: {
              structure: StructureResolver,
            },
    
      {
        path: 'reset-password',
    
            canActivate: [ResetPasswordTokenGuard],
    
            component: ForgotPasswordComponent,
    
        title: buildTitle('Newsletter'),
    
        children: [
          {
            path: '',
            component: NewsletterSubscriptionComponent,
          },
          footerOutletRoute,
        ],
    
        children: [
          {
            path: '',
            component: NewsletterSubscriptionComponent,
          },
          footerOutletRoute,
        ],
    
        title: buildTitle('Annuaire'),
    
        children: [
          {
            path: '',
            component: AnnuaireComponent,
          },
          footerOutletRoute,
        ],
      },
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
        path: 'news',
    
        title: buildTitle('Actualités'),
    
        children: [
          {
            path: '',
            loadChildren: () => import('./post/post.module').then((m) => m.PostModule),
          },
          footerOutletRoute,
        ],
    
        title: buildTitle('Admin'),
    
        children: [
          {
            path: '',
            canActivate: [AdminGuard],
            loadChildren: () => import('./admin/admin.module').then((m) => m.AdminModule),
          },
        ],
    
        loadChildren: () => import('./form/form-view/form-view.module').then((m) => m.FormViewModule),
      },
    
        title: buildTitle('Orientation'),
    
        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,
            resolve: {
              structure: StructureResolver,
            },
          },
        ],
    
      {
        path: 'home',
        redirectTo: 'news',
      },
    
        redirectTo: 'news',
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    
    @NgModule({
    
      imports: [RouterModule.forRoot(routes)],
    
      exports: [RouterModule],
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    })
    
    export class AppRoutingModule {}