Skip to content
Snippets Groups Projects
Select Git revision
  • 5e38d3514af78b027354ec47a71da3893c22e1f8
  • dev default protected
  • 718-evenement-filtre-commune
  • renovate/major-storybook-monorepo
  • renovate/ngx-toastr-19.x
  • renovate/ngx-matomo-client-8.x
  • renovate/bluehalo-ngx-leaflet-20.x
  • renovate/major-angularmaterial-monorepo
  • renovate/major-angular-monorepo
  • renovate/major-ag-grid-monorepo
  • renovate/major-typescript-eslint-monorepo
  • renovate/npm-11.x
  • renovate/ng-packagr-20.x
  • renovate/chromatic-com-storybook-4.x
  • renovate/major-angular-eslint-monorepo
  • renovate/major-angular-cli-monorepo
  • renovate/leaflet.locatecontrol-0.x
  • renovate/devdependencies-(non-major)
  • renovate/chokidar-4.x
  • 168-pro-connect
  • master protected
  • v4.0.2
  • v4.0.1
  • v4.0.0
  • v3.4.3
  • v3.4.2
  • v3.4.1
  • v3.4.0
  • v3.3.1
  • v3.3.0
  • v3.2.2
  • v3.2.1
  • v3.2.0
  • v3.1.0-openshift
  • v3.1.0
  • v3.0.2
  • v3.0.1
  • v3.0.0
  • v2.5.0
  • v2.4.2
  • v2.4.1
41 results

app-routing.module.ts

Blame
  • app-routing.module.ts 7.24 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 { 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 { ResetPasswordComponent } from './reset-password/reset-password.component';
    import { StructureResolver } from './resolvers/structure.resolver';
    import { PasswordFormComponent } from './shared/components';
    import { StructureListPrintComponent } from './shared/components/structure-list-print/structure-list-print.component';
    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 { StructureExcludeComponent } from './structure/structure-exclude/structure-exclude.component';
    import { StructureJoinComponent } from './structure/structure-join/structure-join.component';
    
    const footerOutletRoute: Route = {
      path: '',
      outlet: 'footer',
      component: FooterComponent,
    };
    
    function buildTitle(pageTitle: string = '') {
      let title: string = "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: 'structure', component: StructureDetailsComponent }, footerOutletRoute],
      },
      {
        path: 'print',
        outlet: 'print',
        children: [{ path: 'structures', component: StructureListPrintComponent }, footerOutletRoute],
      },
      {
        path: 'print',
        outlet: 'print',
        children: [{ path: 'structures-search', component: StructureListSearchPrintComponent }, footerOutletRoute],
      },
      {
        path: 'acteurs',
        title: buildTitle('Cartographie'),
        children: [
          {
            path: '',
            component: CartoComponent,
          },
          {
            path: '',
            outlet: 'left-pane',
            component: StructureDetailsComponent,
            resolve: {
              structure: StructureResolver,
            },
          },
        ],
      },
      {
        path: 'login',
        title: buildTitle('Connexion'),
        children: [
          {
            path: '',
            component: LoginComponent,
          },
          footerOutletRoute,
        ],
      },
      {
        path: 'structures',
        children: [
          {
            path: '',
            component: StructureListComponent,
          },
          footerOutletRoute,
        ],
      },
      {
        path: 'legal-notice',
        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,
          },
          footerOutletRoute,
        ],
      },
      {
        path: 'change-email/:id',
        children: [
          {
            path: '',
            component: ResetEmailComponent,
          },
          footerOutletRoute,
        ],
      },
      {
        path: 'profile',
        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,
            },
          },
          footerOutletRoute,
        ],
      },
      {
        path: 'join-validation',
        children: [
          {
            path: '',
            canActivate: [AuthGuard],
            component: StructureJoinComponent,
            resolve: {
              structure: StructureResolver,
            },
          },
          footerOutletRoute,
        ],
      },
      {
        path: 'exclude',
        children: [
          {
            path: '',
            canActivate: [AuthGuard],
            component: StructureExcludeComponent,
          },
          footerOutletRoute,
        ],
      },
      {
        path: 'reset-password',
        children: [
          {
            path: '',
            component: ResetPasswordComponent,
          },
          footerOutletRoute,
        ],
      },
      {
        path: 'new-password',
        component: PasswordFormComponent,
      },
      {
        path: 'newsletter',
        title: buildTitle('Newsletter'),
        children: [
          {
            path: '',
            component: NewsletterSubscriptionComponent,
          },
          footerOutletRoute,
        ],
      },
      {
        path: 'newsletter-unsubscribe',
        children: [
          {
            path: '',
            component: NewsletterSubscriptionComponent,
          },
          footerOutletRoute,
        ],
      },
      {
        path: 'annuaire',
        title: buildTitle('Annuaire'),
        children: [
          {
            path: '',
            component: AnnuaireComponent,
          },
          footerOutletRoute,
        ],
      },
      {
        path: 'news',
        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: 'form',
        title: buildTitle(),
        loadChildren: () => import('./form/form-view/form-view.module').then((m) => m.FormViewModule),
      },
      {
        path: 'orientation',
        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',
      },
      {
        path: '**',
        redirectTo: 'news',
      },
    ];
    
    @NgModule({
      imports: [RouterModule.forRoot(routes)],
      exports: [RouterModule],
    })
    export class AppRoutingModule {}