MOBILE-4616: Document routing modules

main
Noel De Martin 2024-06-27 16:35:12 +02:00
parent 92cc64734b
commit 19a9fe11be
8 changed files with 57 additions and 6 deletions

View File

@ -73,6 +73,7 @@ const mainMenuRoutes: Routes = [
), ),
]; ];
// Single Activity format navigation.
const courseContentsRoutes: Routes = conditionalRoutes( const courseContentsRoutes: Routes = conditionalRoutes(
[ [
{ {

View File

@ -219,6 +219,9 @@ export function resolveModuleRoutes(injector: Injector, token: InjectionToken<Mo
export const APP_ROUTES = new InjectionToken('APP_ROUTES'); export const APP_ROUTES = new InjectionToken('APP_ROUTES');
/**
* Module used to register routes at the root of the application.
*/
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forRoot([]), RouterModule.forRoot([]),

View File

@ -28,6 +28,10 @@ export function resolveContentsRoutes(injector: Injector): ModuleRoutes {
return resolveModuleRoutes(injector, COURSE_CONTENTS_ROUTES); return resolveModuleRoutes(injector, COURSE_CONTENTS_ROUTES);
} }
/**
* Module used to register routes in the course contents page. These are routes that will only be used on
* single activity courses where the activity uses split-view navigation in tablets, such as forum or glossary.
*/
@NgModule() @NgModule()
export class CoreCourseContentsRoutingModule { export class CoreCourseContentsRoutingModule {

View File

@ -28,6 +28,16 @@ export function resolveIndexRoutes(injector: Injector): ModuleRoutes {
return resolveModuleRoutes(injector, COURSE_INDEX_ROUTES); return resolveModuleRoutes(injector, COURSE_INDEX_ROUTES);
} }
/**
* Module used to register routes in the main course page. These are routes that will appear as tabs in the main page of a course,
* and they must also be declared in a CoreCourseOptionsHandler or in plugins using the CoreCourseOptionsDelegate.
*
* Some examples of routes registered in this module are:
* - /main/{tab}/course/{courseId}/contents
* - /main/{tab}/course/{courseId}/participants
* - /main/{tab}/course/{courseId}/grades
* - ...
*/
@NgModule() @NgModule()
export class CoreCourseIndexRoutingModule { export class CoreCourseIndexRoutingModule {

View File

@ -28,6 +28,15 @@ export function resolveHomeRoutes(injector: Injector): ModuleRoutes {
return resolveModuleRoutes(injector, MAIN_MENU_HOME_ROUTES); return resolveModuleRoutes(injector, MAIN_MENU_HOME_ROUTES);
} }
/**
* Module used to register routes in the home main menu tab. These are routes that will appear as tabs in the home page,
* and they must also be declared in a CoreMainMenuHomeHandler or in plugins using the CoreMainMenuHomeDelegate.
*
* Some examples of routes registered in this module are:
* - /main/home/dashboard
* - /main/home/site
* - ...
*/
@NgModule() @NgModule()
export class CoreMainMenuHomeRoutingModule { export class CoreMainMenuHomeRoutingModule {

View File

@ -28,6 +28,16 @@ export function resolveMainMenuRoutes(injector: Injector): ModuleRoutes {
return resolveModuleRoutes(injector, MAIN_MENU_ROUTES); return resolveModuleRoutes(injector, MAIN_MENU_ROUTES);
} }
/**
* Module used to register routes in the main menu tab. These are routes that will appear as tabs in the main menu (or overflow
* into the more page), and they must also be declared in a CoreMainMenuHandler or in plugins using the CoreMainMenuDelegate.
*
* Some examples of routes registered in this module are:
* - /main/calendar
* - /main/messages
* - /main/notifications
* - ...
*/
@NgModule() @NgModule()
export class CoreMainMenuRoutingModule { export class CoreMainMenuRoutingModule {

View File

@ -42,15 +42,19 @@ export function buildTabMainRoutes(injector: Injector, mainRoute: Route): Routes
return [mainRoute, ...routes.siblings]; return [mainRoute, ...routes.siblings];
} }
/**
* Module used to register children routes for all main menu tabs. These are routes that can be navigated within any tab in the
* main menu, but will remain within the navigation stack of the tab rather than overriding the main menu or moving to another tab.
*
* Some examples of routes registered in this module are:
* - /main/{tab}/user
* - /main/{tab}/badges
* - /main/{tab}/mod_forum
* - ...
*/
@NgModule() @NgModule()
export class CoreMainMenuTabRoutingModule { export class CoreMainMenuTabRoutingModule {
/**
* Use this function to declare routes that will be children of all main menu tabs root routes.
*
* @param routes Routes to be children of main menu tabs.
* @returns Calculated module.
*/
static forChild(routes: ModuleRoutesConfig): ModuleWithProviders<CoreMainMenuTabRoutingModule> { static forChild(routes: ModuleRoutesConfig): ModuleWithProviders<CoreMainMenuTabRoutingModule> {
return { return {
ngModule: CoreMainMenuTabRoutingModule, ngModule: CoreMainMenuTabRoutingModule,

View File

@ -28,6 +28,16 @@ export function resolveSiteRoutes(injector: Injector): ModuleRoutes {
return resolveModuleRoutes(injector, SITE_PREFERENCES_ROUTES); return resolveModuleRoutes(injector, SITE_PREFERENCES_ROUTES);
} }
/**
* Module used to register routes in the site preferences page. These are routes that must also be declared in a
* CoreSettingsHandler or in plugins using the CoreSettingsDelegate.
*
* Some examples of routes registered in this module are:
* - /main/{tab}/preferences/storage
* - /main/{tab}/preferences/messages
* - /main/{tab}/preferences/notifications
* - ...
*/
@NgModule() @NgModule()
export class CoreSitePreferencesRoutingModule { export class CoreSitePreferencesRoutingModule {