2020-12-14 14:50:37 +01:00
|
|
|
// (C) Copyright 2015 Moodle Pty Ltd.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2023-01-25 11:08:36 +01:00
|
|
|
import { CoreSharedModule } from '@/core/shared.module';
|
|
|
|
import { AddonCalendarComponentsModule } from '@addons/calendar/components/components.module';
|
|
|
|
import { AddonCalendarDayPage } from '@addons/calendar/pages/day/day';
|
|
|
|
import { AddonCalendarEditEventPage } from '@addons/calendar/pages/edit-event/edit-event';
|
|
|
|
import { AddonCalendarEventPage } from '@addons/calendar/pages/event/event';
|
|
|
|
import { AddonCalendarIndexPage } from '@addons/calendar/pages/index';
|
|
|
|
import { AddonCalendarSettingsPage } from '@addons/calendar/pages/settings/settings';
|
2020-12-14 14:50:37 +01:00
|
|
|
import { Injector, NgModule } from '@angular/core';
|
2021-09-10 12:31:54 +02:00
|
|
|
import { RouterModule, ROUTES, Routes } from '@angular/router';
|
2023-01-25 11:08:36 +01:00
|
|
|
import { CoreEditorComponentsModule } from '@features/editor/components/components.module';
|
|
|
|
import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/components.module';
|
2020-12-14 14:50:37 +01:00
|
|
|
|
|
|
|
import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.module';
|
2021-06-10 14:54:36 +02:00
|
|
|
import { AddonCalendarMainMenuHandlerService } from './services/handlers/mainmenu';
|
2020-12-14 14:50:37 +01:00
|
|
|
|
2023-01-25 11:08:36 +01:00
|
|
|
/**
|
|
|
|
* Build module routes.
|
|
|
|
*
|
|
|
|
* @param injector Injector.
|
|
|
|
* @returns Routes.
|
|
|
|
*/
|
2020-12-14 14:50:37 +01:00
|
|
|
function buildRoutes(injector: Injector): Routes {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
path: 'index',
|
2023-01-25 11:08:36 +01:00
|
|
|
data: { mainMenuTabRoot: AddonCalendarMainMenuHandlerService.PAGE_NAME },
|
|
|
|
component: AddonCalendarIndexPage,
|
2020-12-14 14:50:37 +01:00
|
|
|
},
|
|
|
|
{
|
2022-03-17 16:14:01 +01:00
|
|
|
path: 'calendar-settings',
|
2023-01-25 11:08:36 +01:00
|
|
|
component: AddonCalendarSettingsPage,
|
2020-12-14 14:50:37 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'day',
|
2023-01-25 11:08:36 +01:00
|
|
|
component: AddonCalendarDayPage,
|
2020-12-14 14:50:37 +01:00
|
|
|
},
|
2021-09-10 12:31:54 +02:00
|
|
|
{
|
|
|
|
path: 'event/:id',
|
2023-01-25 11:08:36 +01:00
|
|
|
component: AddonCalendarEventPage,
|
2021-09-10 12:31:54 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'edit/:eventId',
|
2023-01-25 11:08:36 +01:00
|
|
|
component: AddonCalendarEditEventPage,
|
2021-09-10 12:31:54 +02:00
|
|
|
},
|
2020-12-14 14:50:37 +01:00
|
|
|
...buildTabMainRoutes(injector, {
|
|
|
|
redirectTo: 'index',
|
|
|
|
pathMatch: 'full',
|
|
|
|
}),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
@NgModule({
|
2023-01-25 11:08:36 +01:00
|
|
|
imports: [
|
|
|
|
CoreSharedModule,
|
|
|
|
AddonCalendarComponentsModule,
|
|
|
|
CoreMainMenuComponentsModule,
|
|
|
|
CoreEditorComponentsModule,
|
|
|
|
],
|
2020-12-14 14:50:37 +01:00
|
|
|
exports: [RouterModule],
|
2023-01-25 11:08:36 +01:00
|
|
|
declarations: [
|
|
|
|
AddonCalendarDayPage,
|
|
|
|
AddonCalendarEditEventPage,
|
|
|
|
AddonCalendarEventPage,
|
|
|
|
AddonCalendarIndexPage,
|
|
|
|
AddonCalendarSettingsPage,
|
|
|
|
],
|
2020-12-14 14:50:37 +01:00
|
|
|
providers: [
|
|
|
|
{
|
|
|
|
provide: ROUTES,
|
|
|
|
multi: true,
|
|
|
|
deps: [Injector],
|
|
|
|
useFactory: buildRoutes,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
})
|
2023-01-25 11:08:36 +01:00
|
|
|
export class AddonCalendarLazyModule {}
|