From bbe5d73241a67666c123f4729ec9d9de66ff4cc4 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Tue, 24 Jan 2023 11:15:43 +0100 Subject: [PATCH 1/4] MOBILE-3942 core: Allow declaring ion-item button Using strictTemplates, it was throwing an error if an ion-item has a button attribute without any value. --- patches/@ionic+core+5.9.2.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 patches/@ionic+core+5.9.2.patch diff --git a/patches/@ionic+core+5.9.2.patch b/patches/@ionic+core+5.9.2.patch new file mode 100644 index 000000000..05dab373c --- /dev/null +++ b/patches/@ionic+core+5.9.2.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/@ionic/core/dist/types/components.d.ts b/node_modules/@ionic/core/dist/types/components.d.ts +index fd9b7ad..4d29d1e 100644 +--- a/node_modules/@ionic/core/dist/types/components.d.ts ++++ b/node_modules/@ionic/core/dist/types/components.d.ts +@@ -972,7 +972,7 @@ export namespace Components { + /** + * If `true`, a button tag will be rendered and the item will be tappable. + */ +- "button": boolean; ++ "button": boolean | ''; + /** + * The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). + */ From ce9e2013debede146d3a7a156f29fd1414c2d9e7 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 26 Jan 2023 17:10:16 +0100 Subject: [PATCH 2/4] MOBILE-4270 vscode: Recommend Angular extension --- .vscode/extensions.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 12ffc2065..71bb27499 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,5 +1,6 @@ { "recommendations": [ - "dbaeumer.vscode-eslint" + "dbaeumer.vscode-eslint", + "angular.ng-template" ] } From 98d332138ada739a00e29694cfa7d7254464ea3a Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Wed, 25 Jan 2023 11:08:36 +0100 Subject: [PATCH 3/4] MOBILE-4270 core: Standardize page modules --- src/addons/badges/badges-lazy.module.ts | 4 +- .../{issued-badge.page.ts => issued-badge.ts} | 0 .../{user-badges.page.ts => user-badges.ts} | 0 src/addons/block/block.module.ts | 2 +- src/addons/blog/blog-lazy.module.ts | 6 + src/addons/blog/blog.module.ts | 2 +- src/addons/calendar/calendar-lazy.module.ts | 47 +++++-- .../pages/day/{day.page.ts => day.ts} | 0 .../pages/edit-event/edit-event.module.ts | 43 ------ .../{edit-event.page.ts => edit-event.ts} | 0 .../calendar/pages/event/event.module.ts | 41 ------ .../pages/event/{event.page.ts => event.ts} | 0 .../calendar/pages/index/index.module.ts | 43 ------ .../pages/index/{index.page.ts => index.ts} | 0 .../pages/settings/settings.module.ts | 38 ------ src/addons/competency/competency.module.ts | 2 +- .../coursecompletion.module.ts | 2 +- src/addons/filter/filter.module.ts | 2 +- .../airnotifier/airnotifier.module.ts | 6 +- .../pages/devices/devices.module.ts | 38 ------ src/addons/messages/messages-lazy.module.ts | 124 ++++++++++++++---- ...le.ts => messages-settings-lazy.module.ts} | 5 +- src/addons/messages/messages.module.ts | 4 +- .../pages/contacts-35/contacts.module.ts | 58 -------- .../{contacts.page.ts => contacts.ts} | 0 .../pages/contacts/contacts.module.ts | 56 -------- .../{contacts.page.ts => contacts.ts} | 0 .../pages/discussion/discussion.module.ts | 41 ------ .../{discussion.page.ts => discussion.ts} | 0 .../discussions-35/discussions.module.ts | 67 ---------- .../{discussions.page.ts => discussions.ts} | 0 .../group-conversations.module.ts | 65 --------- ...sations.page.ts => group-conversations.ts} | 0 .../messages/pages/search/search.module.ts | 58 -------- .../search/{search.page.ts => search.ts} | 0 .../{settings.page.ts => settings.ts} | 0 src/addons/mod/assign/assign-lazy.module.ts | 4 +- .../mod/assign/feedback/feedback.module.ts | 2 +- .../pages/index/{index.page.ts => index.ts} | 0 ...ission-list.page.ts => submission-list.ts} | 0 .../assign/submission/submission.module.ts | 2 +- src/addons/mod/book/book-lazy.module.ts | 8 +- .../book/pages/contents/contents.module.ts | 40 ------ .../pages/index/{index.page.ts => index.ts} | 0 src/addons/mod/data/fields/field.module.ts | 2 +- .../mod/feedback/feedback-lazy.module.ts | 19 ++- .../feedback/pages/attempt/attempt.module.ts | 37 ------ .../mod/feedback/pages/form/form.module.ts | 39 ------ .../nonrespondents/nonrespondents.module.ts | 37 ------ src/addons/mod/folder/folder-lazy.module.ts | 2 +- .../pages/index/{index.page.ts => index.ts} | 2 +- src/addons/mod/forum/components/post/post.ts | 2 +- ...ule.ts => forum-discussion-lazy.module.ts} | 5 +- src/addons/mod/forum/forum-lazy.module.ts | 14 +- ...ts => forum-new-discussion-lazy.module.ts} | 5 +- src/addons/mod/forum/forum.module.ts | 14 +- .../{discussion.page.ts => discussion.ts} | 0 .../pages/index/{index.page.ts => index.ts} | 2 +- ...w-discussion.page.ts => new-discussion.ts} | 0 ...module.ts => glossary-edit-lazy.module.ts} | 4 +- ...odule.ts => glossary-entry-lazy.module.ts} | 4 +- .../mod/glossary/glossary-lazy.module.ts | 8 +- src/addons/mod/glossary/glossary.module.ts | 14 +- .../h5pactivity/h5pactivity-lazy.module.ts | 15 ++- .../attempt-results/attempt-results.module.ts | 38 ------ .../user-attempts/user-attempts.module.ts | 38 ------ .../users-attempts/users-attempts.module.ts | 38 ------ src/addons/mod/imscp/imscp-lazy.module.ts | 6 +- .../pages/index/{index.page.ts => index.ts} | 0 .../mod/imscp/pages/view/view.module.ts | 38 ------ .../components/menu-modal/menu-modal.ts | 2 +- src/addons/mod/lesson/lesson-lazy.module.ts | 14 +- .../pages/index/{index.page.ts => index.ts} | 0 .../mod/lesson/pages/player/player.module.ts | 42 ------ .../player/{player.page.ts => player.ts} | 0 .../pages/user-retake/user-retake.module.ts | 38 ------ .../{user-retake.page.ts => user-retake.ts} | 0 src/addons/mod/lti/lti-lazy.module.ts | 2 +- .../pages/index/{index.page.ts => index.ts} | 0 src/addons/mod/mod.module.ts | 2 +- src/addons/mod/page/page-lazy.module.ts | 2 +- .../pages/index/{index.page.ts => index.ts} | 0 .../quiz/accessrules/accessrules.module.ts | 2 +- .../mod/quiz/pages/attempt/attempt.module.ts | 38 ------ .../attempt/{attempt.page.ts => attempt.ts} | 0 .../pages/index/{index.page.ts => index.ts} | 0 .../mod/quiz/pages/player/player.module.ts | 42 ------ .../player/{player.page.ts => player.ts} | 0 .../mod/quiz/pages/review/review.module.ts | 40 ------ .../review/{review.page.ts => review.ts} | 0 src/addons/mod/quiz/quiz-lazy.module.ts | 18 ++- .../pages/index/{index.page.ts => index.ts} | 0 .../mod/resource/resource-lazy.module.ts | 2 +- .../pages/index/{index.page.ts => index.ts} | 0 src/addons/mod/url/url-lazy.module.ts | 2 +- src/addons/notes/notes-lazy.module.ts | 2 +- src/addons/notes/notes.module.ts | 2 +- .../pages/list/{list.page.ts => list.ts} | 0 .../notifications-lazy.module.ts | 36 +++-- ... => notifications-settings-lazy.module.ts} | 4 +- .../notifications/notifications.module.ts | 6 +- .../notifications/pages/list/list.module.ts | 49 ------- .../pages/notification/notification.module.ts | 38 ------ .../privatefiles/pages/index/index.module.ts | 38 ------ .../privatefiles/privatefiles-lazy.module.ts | 18 ++- src/addons/qbehaviour/qbehaviour.module.ts | 2 +- src/addons/qtype/qtype.module.ts | 2 +- src/addons/report/report.module.ts | 2 +- .../storagemanager/storagemanager.module.ts | 2 +- .../userprofilefield.module.ts | 2 +- src/app/app-routing.module.ts | 13 +- .../features/comments/comments-lazy.module.ts | 12 +- .../comments/pages/viewer/viewer.module.ts | 38 ------ .../viewer/{viewer.page.ts => viewer.ts} | 0 ...dule.ts => course-contents-lazy.module.ts} | 16 ++- ...e.ts => course-contents-routing.module.ts} | 16 ++- .../features/course/course-lazy.module.ts | 88 +++++++++---- ...ing.module.ts => course-routing.module.ts} | 16 ++- .../course/course-summary-lazy.module.ts} | 16 +-- src/core/features/course/course.module.ts | 10 +- .../features/course/format/formats.module.ts | 2 +- .../course-summary/course-summary.module.ts | 25 +--- ...urse-summary.ts => course-summary.page.ts} | 0 .../course/pages/index/index.module.ts | 53 -------- .../list-mod-type/list-mod-type.module.ts | 40 ------ ...list-mod-type.page.ts => list-mod-type.ts} | 0 .../module-preview/module-preview.module.ts | 40 ------ ...dule-preview.page.ts => module-preview.ts} | 0 .../features/course/services/course-helper.ts | 4 +- ...le.ts => courses-dashboard-lazy.module.ts} | 5 +- .../features/courses/courses-lazy.module.ts | 30 ++++- ...my.module.ts => courses-my-lazy.module.ts} | 8 +- src/core/features/courses/courses.module.ts | 4 +- .../pages/categories/categories.module.ts | 41 ------ .../courses/pages/list/list.module.ts | 45 ------- src/core/features/courses/pages/my/my.ts | 2 +- .../courses/services/courses-helper.ts | 2 +- src/core/features/filter/filter.module.ts | 2 +- .../grades/grades-courses-lazy.module.ts | 2 +- src/core/features/grades/grades.module.ts | 2 +- .../courses/{courses.page.ts => courses.ts} | 0 ...le.ts => login-credentials-lazy.module.ts} | 4 +- src/core/features/login/login-lazy.module.ts | 23 +++- ...dule.ts => login-reconnect-lazy.module.ts} | 4 +- .../change-password/change-password.module.ts | 38 ------ .../pages/email-signup/email-signup.module.ts | 41 ------ .../pages/site-policy/site-policy.module.ts | 38 ------ .../features/login/pages/site/site.module.ts | 38 ------ .../login/pages/sites/sites.module.ts | 38 ------ .../features/login/services/login-helper.ts | 4 +- ...module.ts => mainmenu-home-lazy.module.ts} | 15 ++- ...ule.ts => mainmenu-home-routing.module.ts} | 16 ++- .../features/mainmenu/mainmenu-lazy.module.ts | 20 +-- ...module.ts => mainmenu-more-lazy.module.ts} | 28 ++-- ...dule.ts => mainmenu-reload-lazy.module.ts} | 4 +- .../mainmenu/mainmenu-routing.module.ts | 16 ++- .../mainmenu/mainmenu-tab-routing.module.ts | 8 +- src/core/features/mainmenu/mainmenu.module.ts | 2 +- .../settings/pages/about/about.module.ts | 38 ------ .../pages/deviceinfo/deviceinfo.module.ts | 44 ------- .../settings/pages/general/general.module.ts | 39 ------ .../pages/licenses/licenses.module.ts | 38 ------ .../pages/space-usage/space-usage.module.ts | 38 ------ .../synchronization/synchronization.module.ts | 38 ------ .../features/settings/settings-lazy.module.ts | 32 +++-- ...module.ts => settings-site-lazy.module.ts} | 19 +-- ...ing.ts => settings-site-routing.module.ts} | 16 ++- src/core/features/settings/settings.module.ts | 2 +- .../sharedfiles/sharedfiles.module.ts | 2 +- ...ndex.module.ts => sitehome-lazy.module.ts} | 5 +- src/core/features/sitehome/sitehome.module.ts | 4 +- .../course-option/course-option.module.ts | 45 ------- .../pages/module-index/module-index.module.ts | 45 ------- .../pages/plugin-page/plugin-page.module.ts | 45 ------- .../plugin-page.html => plugin/plugin.html} | 0 .../plugin-page.ts => plugin/plugin.ts} | 2 +- .../siteplugins/siteplugins.module.ts | 30 +++-- .../index-area/index-area.page.module.ts | 38 ------ .../{index-area.page.ts => index-area.ts} | 0 .../tag/pages/index/index.page.module.ts | 57 -------- .../pages/index/{index.page.ts => index.ts} | 0 .../tag/pages/search/search.page.module.ts | 42 ------ .../search/{search.page.ts => search.ts} | 0 src/core/features/tag/tag-lazy.module.ts | 64 +++++++-- .../features/user/pages/about/about.module.ts | 41 ------ .../pages/about/{about.page.ts => about.ts} | 0 .../{participants.page.ts => participants.ts} | 0 .../profile/{profile.page.ts => profile.ts} | 0 .../features/user/user-course-lazy.module.ts | 4 +- src/core/features/user/user-lazy.module.ts | 16 ++- ....module.ts => user-profile-lazy.module.ts} | 4 +- src/core/features/user/user.module.ts | 4 +- .../viewer/pages/iframe/iframe.module.ts | 38 ------ .../features/viewer/viewer-lazy.module.ts | 12 +- 194 files changed, 749 insertions(+), 2564 deletions(-) rename src/addons/badges/pages/issued-badge/{issued-badge.page.ts => issued-badge.ts} (100%) rename src/addons/badges/pages/user-badges/{user-badges.page.ts => user-badges.ts} (100%) rename src/addons/calendar/pages/day/{day.page.ts => day.ts} (100%) delete mode 100644 src/addons/calendar/pages/edit-event/edit-event.module.ts rename src/addons/calendar/pages/edit-event/{edit-event.page.ts => edit-event.ts} (100%) delete mode 100644 src/addons/calendar/pages/event/event.module.ts rename src/addons/calendar/pages/event/{event.page.ts => event.ts} (100%) delete mode 100644 src/addons/calendar/pages/index/index.module.ts rename src/addons/calendar/pages/index/{index.page.ts => index.ts} (100%) delete mode 100644 src/addons/calendar/pages/settings/settings.module.ts delete mode 100644 src/addons/messageoutput/airnotifier/pages/devices/devices.module.ts rename src/addons/messages/{pages/settings/settings.module.ts => messages-settings-lazy.module.ts} (88%) delete mode 100644 src/addons/messages/pages/contacts-35/contacts.module.ts rename src/addons/messages/pages/contacts-35/{contacts.page.ts => contacts.ts} (100%) delete mode 100644 src/addons/messages/pages/contacts/contacts.module.ts rename src/addons/messages/pages/contacts/{contacts.page.ts => contacts.ts} (100%) delete mode 100644 src/addons/messages/pages/discussion/discussion.module.ts rename src/addons/messages/pages/discussion/{discussion.page.ts => discussion.ts} (100%) delete mode 100644 src/addons/messages/pages/discussions-35/discussions.module.ts rename src/addons/messages/pages/discussions-35/{discussions.page.ts => discussions.ts} (100%) delete mode 100644 src/addons/messages/pages/group-conversations/group-conversations.module.ts rename src/addons/messages/pages/group-conversations/{group-conversations.page.ts => group-conversations.ts} (100%) delete mode 100644 src/addons/messages/pages/search/search.module.ts rename src/addons/messages/pages/search/{search.page.ts => search.ts} (100%) rename src/addons/messages/pages/settings/{settings.page.ts => settings.ts} (100%) rename src/addons/mod/assign/pages/index/{index.page.ts => index.ts} (100%) rename src/addons/mod/assign/pages/submission-list/{submission-list.page.ts => submission-list.ts} (100%) delete mode 100644 src/addons/mod/book/pages/contents/contents.module.ts rename src/addons/mod/book/pages/index/{index.page.ts => index.ts} (100%) delete mode 100644 src/addons/mod/feedback/pages/attempt/attempt.module.ts delete mode 100644 src/addons/mod/feedback/pages/form/form.module.ts delete mode 100644 src/addons/mod/feedback/pages/nonrespondents/nonrespondents.module.ts rename src/addons/mod/folder/pages/index/{index.page.ts => index.ts} (99%) rename src/addons/mod/forum/{pages/discussion/discussion.module.ts => forum-discussion-lazy.module.ts} (89%) rename src/addons/mod/forum/{pages/new-discussion/new-discussion.module.ts => forum-new-discussion-lazy.module.ts} (89%) rename src/addons/mod/forum/pages/discussion/{discussion.page.ts => discussion.ts} (100%) rename src/addons/mod/forum/pages/index/{index.page.ts => index.ts} (98%) rename src/addons/mod/forum/pages/new-discussion/{new-discussion.page.ts => new-discussion.ts} (100%) rename src/addons/mod/glossary/{pages/edit/edit.module.ts => glossary-edit-lazy.module.ts} (90%) rename src/addons/mod/glossary/{pages/entry/entry.module.ts => glossary-entry-lazy.module.ts} (91%) delete mode 100644 src/addons/mod/h5pactivity/pages/attempt-results/attempt-results.module.ts delete mode 100644 src/addons/mod/h5pactivity/pages/user-attempts/user-attempts.module.ts delete mode 100644 src/addons/mod/h5pactivity/pages/users-attempts/users-attempts.module.ts rename src/addons/mod/imscp/pages/index/{index.page.ts => index.ts} (100%) delete mode 100644 src/addons/mod/imscp/pages/view/view.module.ts rename src/addons/mod/lesson/pages/index/{index.page.ts => index.ts} (100%) delete mode 100644 src/addons/mod/lesson/pages/player/player.module.ts rename src/addons/mod/lesson/pages/player/{player.page.ts => player.ts} (100%) delete mode 100644 src/addons/mod/lesson/pages/user-retake/user-retake.module.ts rename src/addons/mod/lesson/pages/user-retake/{user-retake.page.ts => user-retake.ts} (100%) rename src/addons/mod/lti/pages/index/{index.page.ts => index.ts} (100%) rename src/addons/mod/page/pages/index/{index.page.ts => index.ts} (100%) delete mode 100644 src/addons/mod/quiz/pages/attempt/attempt.module.ts rename src/addons/mod/quiz/pages/attempt/{attempt.page.ts => attempt.ts} (100%) rename src/addons/mod/quiz/pages/index/{index.page.ts => index.ts} (100%) delete mode 100644 src/addons/mod/quiz/pages/player/player.module.ts rename src/addons/mod/quiz/pages/player/{player.page.ts => player.ts} (100%) delete mode 100644 src/addons/mod/quiz/pages/review/review.module.ts rename src/addons/mod/quiz/pages/review/{review.page.ts => review.ts} (100%) rename src/addons/mod/resource/pages/index/{index.page.ts => index.ts} (100%) rename src/addons/mod/url/pages/index/{index.page.ts => index.ts} (100%) rename src/addons/notes/pages/list/{list.page.ts => list.ts} (100%) rename src/addons/notifications/{pages/settings/settings.module.ts => notifications-settings-lazy.module.ts} (87%) delete mode 100644 src/addons/notifications/pages/list/list.module.ts delete mode 100644 src/addons/notifications/pages/notification/notification.module.ts delete mode 100644 src/addons/privatefiles/pages/index/index.module.ts delete mode 100644 src/core/features/comments/pages/viewer/viewer.module.ts rename src/core/features/comments/pages/viewer/{viewer.page.ts => viewer.ts} (100%) rename src/core/features/course/{pages/contents/contents.module.ts => course-contents-lazy.module.ts} (79%) rename src/core/features/course/{pages/contents/contents-routing.module.ts => course-contents-routing.module.ts} (66%) rename src/core/features/course/{pages/index/index-routing.module.ts => course-routing.module.ts} (66%) rename src/{addons/calendar/pages/day/day.module.ts => core/features/course/course-summary-lazy.module.ts} (66%) rename src/core/features/course/pages/course-summary/{course-summary.ts => course-summary.page.ts} (100%) delete mode 100644 src/core/features/course/pages/index/index.module.ts delete mode 100644 src/core/features/course/pages/list-mod-type/list-mod-type.module.ts rename src/core/features/course/pages/list-mod-type/{list-mod-type.page.ts => list-mod-type.ts} (100%) delete mode 100644 src/core/features/course/pages/module-preview/module-preview.module.ts rename src/core/features/course/pages/module-preview/{module-preview.page.ts => module-preview.ts} (100%) rename src/core/features/courses/{pages/dashboard/dashboard.module.ts => courses-dashboard-lazy.module.ts} (89%) rename src/core/features/courses/{pages/my/my.module.ts => courses-my-lazy.module.ts} (87%) delete mode 100644 src/core/features/courses/pages/categories/categories.module.ts delete mode 100644 src/core/features/courses/pages/list/list.module.ts rename src/core/features/grades/pages/courses/{courses.page.ts => courses.ts} (100%) rename src/core/features/login/{pages/credentials/credentials.module.ts => login-credentials-lazy.module.ts} (89%) rename src/core/features/login/{pages/reconnect/reconnect.module.ts => login-reconnect-lazy.module.ts} (90%) delete mode 100644 src/core/features/login/pages/change-password/change-password.module.ts delete mode 100644 src/core/features/login/pages/email-signup/email-signup.module.ts delete mode 100644 src/core/features/login/pages/site-policy/site-policy.module.ts delete mode 100644 src/core/features/login/pages/site/site.module.ts delete mode 100644 src/core/features/login/pages/sites/sites.module.ts rename src/core/features/mainmenu/{pages/home/home.module.ts => mainmenu-home-lazy.module.ts} (83%) rename src/core/features/mainmenu/{pages/home/home-routing.module.ts => mainmenu-home-routing.module.ts} (66%) rename src/core/features/mainmenu/{pages/more/more.module.ts => mainmenu-more-lazy.module.ts} (70%) rename src/core/features/mainmenu/{pages/reload/reload.module.ts => mainmenu-reload-lazy.module.ts} (89%) delete mode 100644 src/core/features/settings/pages/about/about.module.ts delete mode 100644 src/core/features/settings/pages/deviceinfo/deviceinfo.module.ts delete mode 100644 src/core/features/settings/pages/general/general.module.ts delete mode 100644 src/core/features/settings/pages/licenses/licenses.module.ts delete mode 100644 src/core/features/settings/pages/space-usage/space-usage.module.ts delete mode 100644 src/core/features/settings/pages/synchronization/synchronization.module.ts rename src/core/features/settings/{pages/site/site.module.ts => settings-site-lazy.module.ts} (80%) rename src/core/features/settings/{pages/site/site-routing.ts => settings-site-routing.module.ts} (66%) rename src/core/features/sitehome/{pages/index/index.module.ts => sitehome-lazy.module.ts} (92%) delete mode 100644 src/core/features/siteplugins/pages/course-option/course-option.module.ts delete mode 100644 src/core/features/siteplugins/pages/module-index/module-index.module.ts delete mode 100644 src/core/features/siteplugins/pages/plugin-page/plugin-page.module.ts rename src/core/features/siteplugins/pages/{plugin-page/plugin-page.html => plugin/plugin.html} (100%) rename src/core/features/siteplugins/pages/{plugin-page/plugin-page.ts => plugin/plugin.ts} (99%) delete mode 100644 src/core/features/tag/pages/index-area/index-area.page.module.ts rename src/core/features/tag/pages/index-area/{index-area.page.ts => index-area.ts} (100%) delete mode 100644 src/core/features/tag/pages/index/index.page.module.ts rename src/core/features/tag/pages/index/{index.page.ts => index.ts} (100%) delete mode 100644 src/core/features/tag/pages/search/search.page.module.ts rename src/core/features/tag/pages/search/{search.page.ts => search.ts} (100%) delete mode 100644 src/core/features/user/pages/about/about.module.ts rename src/core/features/user/pages/about/{about.page.ts => about.ts} (100%) rename src/core/features/user/pages/participants/{participants.page.ts => participants.ts} (100%) rename src/core/features/user/pages/profile/{profile.page.ts => profile.ts} (100%) rename src/core/features/user/{pages/profile/profile.module.ts => user-profile-lazy.module.ts} (89%) delete mode 100644 src/core/features/viewer/pages/iframe/iframe.module.ts diff --git a/src/addons/badges/badges-lazy.module.ts b/src/addons/badges/badges-lazy.module.ts index bd6cd1392..e23e2d26c 100644 --- a/src/addons/badges/badges-lazy.module.ts +++ b/src/addons/badges/badges-lazy.module.ts @@ -19,8 +19,8 @@ import { conditionalRoutes } from '@/app/app-routing.module'; import { CoreScreen } from '@services/screen'; import { CoreSharedModule } from '@/core/shared.module'; -import { AddonBadgesIssuedBadgePage } from './pages/issued-badge/issued-badge.page'; -import { AddonBadgesUserBadgesPage } from './pages/user-badges/user-badges.page'; +import { AddonBadgesIssuedBadgePage } from './pages/issued-badge/issued-badge'; +import { AddonBadgesUserBadgesPage } from './pages/user-badges/user-badges'; const mobileRoutes: Routes = [ { diff --git a/src/addons/badges/pages/issued-badge/issued-badge.page.ts b/src/addons/badges/pages/issued-badge/issued-badge.ts similarity index 100% rename from src/addons/badges/pages/issued-badge/issued-badge.page.ts rename to src/addons/badges/pages/issued-badge/issued-badge.ts diff --git a/src/addons/badges/pages/user-badges/user-badges.page.ts b/src/addons/badges/pages/user-badges/user-badges.ts similarity index 100% rename from src/addons/badges/pages/user-badges/user-badges.page.ts rename to src/addons/badges/pages/user-badges/user-badges.ts diff --git a/src/addons/block/block.module.ts b/src/addons/block/block.module.ts index 98738faf6..f62aa4481 100644 --- a/src/addons/block/block.module.ts +++ b/src/addons/block/block.module.ts @@ -73,4 +73,4 @@ import { AddonBlockTimelineModule } from './timeline/timeline.module'; AddonBlockTimelineModule, ], }) -export class AddonBlockModule { } +export class AddonBlockModule {} diff --git a/src/addons/blog/blog-lazy.module.ts b/src/addons/blog/blog-lazy.module.ts index 2bd801405..5eea47053 100644 --- a/src/addons/blog/blog-lazy.module.ts +++ b/src/addons/blog/blog-lazy.module.ts @@ -24,6 +24,12 @@ import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.modu import { AddonBlogMainMenuHandlerService } from './services/handlers/mainmenu'; import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/components.module'; +/** + * Build module routes. + * + * @param injector Injector. + * @returns Routes. + */ function buildRoutes(injector: Injector): Routes { return [ ...buildTabMainRoutes(injector, { diff --git a/src/addons/blog/blog.module.ts b/src/addons/blog/blog.module.ts index f933599fb..2abe6c8ca 100644 --- a/src/addons/blog/blog.module.ts +++ b/src/addons/blog/blog.module.ts @@ -15,7 +15,7 @@ import { APP_INITIALIZER, NgModule, Type } from '@angular/core'; import { Routes } from '@angular/router'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; -import { CoreCourseIndexRoutingModule } from '@features/course/pages/index/index-routing.module'; +import { CoreCourseIndexRoutingModule } from '@features/course/course-routing.module'; import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate'; import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; diff --git a/src/addons/calendar/calendar-lazy.module.ts b/src/addons/calendar/calendar-lazy.module.ts index c01e053cc..86f19555f 100644 --- a/src/addons/calendar/calendar-lazy.module.ts +++ b/src/addons/calendar/calendar-lazy.module.ts @@ -12,39 +12,49 @@ // See the License for the specific language governing permissions and // limitations under the License. +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'; import { Injector, NgModule } from '@angular/core'; import { RouterModule, ROUTES, Routes } from '@angular/router'; +import { CoreEditorComponentsModule } from '@features/editor/components/components.module'; +import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/components.module'; import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.module'; import { AddonCalendarMainMenuHandlerService } from './services/handlers/mainmenu'; +/** + * Build module routes. + * + * @param injector Injector. + * @returns Routes. + */ function buildRoutes(injector: Injector): Routes { return [ { path: 'index', - data: { - mainMenuTabRoot: AddonCalendarMainMenuHandlerService.PAGE_NAME, - }, - loadChildren: () => import('@addons/calendar/pages/index/index.module').then(m => m.AddonCalendarIndexPageModule), + data: { mainMenuTabRoot: AddonCalendarMainMenuHandlerService.PAGE_NAME }, + component: AddonCalendarIndexPage, }, { path: 'calendar-settings', - loadChildren: () => - import('@addons/calendar/pages/settings/settings.module').then(m => m.AddonCalendarSettingsPageModule), + component: AddonCalendarSettingsPage, }, { path: 'day', - loadChildren: () => - import('@addons/calendar/pages/day/day.module').then(m => m.AddonCalendarDayPageModule), + component: AddonCalendarDayPage, }, { path: 'event/:id', - loadChildren: () => import('@addons/calendar/pages/event/event.module').then(m => m.AddonCalendarEventPageModule), + component: AddonCalendarEventPage, }, { path: 'edit/:eventId', - loadChildren: () => - import('@addons/calendar/pages/edit-event/edit-event.module').then(m => m.AddonCalendarEditEventPageModule), + component: AddonCalendarEditEventPage, }, ...buildTabMainRoutes(injector, { redirectTo: 'index', @@ -54,7 +64,20 @@ function buildRoutes(injector: Injector): Routes { } @NgModule({ + imports: [ + CoreSharedModule, + AddonCalendarComponentsModule, + CoreMainMenuComponentsModule, + CoreEditorComponentsModule, + ], exports: [RouterModule], + declarations: [ + AddonCalendarDayPage, + AddonCalendarEditEventPage, + AddonCalendarEventPage, + AddonCalendarIndexPage, + AddonCalendarSettingsPage, + ], providers: [ { provide: ROUTES, @@ -64,4 +87,4 @@ function buildRoutes(injector: Injector): Routes { }, ], }) -export class AddonCalendarLazyModule { } +export class AddonCalendarLazyModule {} diff --git a/src/addons/calendar/pages/day/day.page.ts b/src/addons/calendar/pages/day/day.ts similarity index 100% rename from src/addons/calendar/pages/day/day.page.ts rename to src/addons/calendar/pages/day/day.ts diff --git a/src/addons/calendar/pages/edit-event/edit-event.module.ts b/src/addons/calendar/pages/edit-event/edit-event.module.ts deleted file mode 100644 index 0acf07633..000000000 --- a/src/addons/calendar/pages/edit-event/edit-event.module.ts +++ /dev/null @@ -1,43 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreEditorComponentsModule } from '@features/editor/components/components.module'; - -import { AddonCalendarEditEventPage } from './edit-event.page'; -import { CanLeaveGuard } from '@guards/can-leave'; - -const routes: Routes = [ - { - path: '', - component: AddonCalendarEditEventPage, - canDeactivate: [CanLeaveGuard], - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreEditorComponentsModule, - ], - declarations: [ - AddonCalendarEditEventPage, - ], - exports: [RouterModule], -}) -export class AddonCalendarEditEventPageModule {} diff --git a/src/addons/calendar/pages/edit-event/edit-event.page.ts b/src/addons/calendar/pages/edit-event/edit-event.ts similarity index 100% rename from src/addons/calendar/pages/edit-event/edit-event.page.ts rename to src/addons/calendar/pages/edit-event/edit-event.ts diff --git a/src/addons/calendar/pages/event/event.module.ts b/src/addons/calendar/pages/event/event.module.ts deleted file mode 100644 index 56f1225ac..000000000 --- a/src/addons/calendar/pages/event/event.module.ts +++ /dev/null @@ -1,41 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { AddonCalendarComponentsModule } from '../../components/components.module'; - -import { AddonCalendarEventPage } from './event.page'; - -const routes: Routes = [ - { - path: '', - component: AddonCalendarEventPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - AddonCalendarComponentsModule, - ], - declarations: [ - AddonCalendarEventPage, - ], - exports: [RouterModule], -}) -export class AddonCalendarEventPageModule {} diff --git a/src/addons/calendar/pages/event/event.page.ts b/src/addons/calendar/pages/event/event.ts similarity index 100% rename from src/addons/calendar/pages/event/event.page.ts rename to src/addons/calendar/pages/event/event.ts diff --git a/src/addons/calendar/pages/index/index.module.ts b/src/addons/calendar/pages/index/index.module.ts deleted file mode 100644 index 0ecbc7b6e..000000000 --- a/src/addons/calendar/pages/index/index.module.ts +++ /dev/null @@ -1,43 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { AddonCalendarComponentsModule } from '../../components/components.module'; - -import { AddonCalendarIndexPage } from './index.page'; -import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/components.module'; - -const routes: Routes = [ - { - path: '', - component: AddonCalendarIndexPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - AddonCalendarComponentsModule, - CoreMainMenuComponentsModule, - ], - declarations: [ - AddonCalendarIndexPage, - ], - exports: [RouterModule], -}) -export class AddonCalendarIndexPageModule {} diff --git a/src/addons/calendar/pages/index/index.page.ts b/src/addons/calendar/pages/index/index.ts similarity index 100% rename from src/addons/calendar/pages/index/index.page.ts rename to src/addons/calendar/pages/index/index.ts diff --git a/src/addons/calendar/pages/settings/settings.module.ts b/src/addons/calendar/pages/settings/settings.module.ts deleted file mode 100644 index 25fe2f46c..000000000 --- a/src/addons/calendar/pages/settings/settings.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { AddonCalendarSettingsPage } from './settings'; -import { CoreSharedModule } from '@/core/shared.module'; - -const routes: Routes = [ - { - path: '', - component: AddonCalendarSettingsPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - AddonCalendarSettingsPage, - ], - exports: [RouterModule], -}) -export class AddonCalendarSettingsPageModule {} diff --git a/src/addons/competency/competency.module.ts b/src/addons/competency/competency.module.ts index b55e996c8..d705ed1c3 100644 --- a/src/addons/competency/competency.module.ts +++ b/src/addons/competency/competency.module.ts @@ -29,7 +29,7 @@ import { AddonCompetencyUserHandler } from './services/handlers/user'; import { Routes } from '@angular/router'; import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; -import { CoreCourseIndexRoutingModule } from '@features/course/pages/index/index-routing.module'; +import { CoreCourseIndexRoutingModule } from '@features/course/course-routing.module'; import { COURSE_PAGE_NAME } from '@features/course/course.module'; import { PARTICIPANTS_PAGE_NAME } from '@features/user/user.module'; diff --git a/src/addons/coursecompletion/coursecompletion.module.ts b/src/addons/coursecompletion/coursecompletion.module.ts index d58a4fdc5..9ad8c137f 100644 --- a/src/addons/coursecompletion/coursecompletion.module.ts +++ b/src/addons/coursecompletion/coursecompletion.module.ts @@ -15,7 +15,7 @@ import { APP_INITIALIZER, NgModule, Type } from '@angular/core'; import { Routes } from '@angular/router'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; -import { CoreCourseIndexRoutingModule } from '@features/course/pages/index/index-routing.module'; +import { CoreCourseIndexRoutingModule } from '@features/course/course-routing.module'; import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreUserDelegate } from '@features/user/services/user-delegate'; diff --git a/src/addons/filter/filter.module.ts b/src/addons/filter/filter.module.ts index da92525ed..308b41ec0 100644 --- a/src/addons/filter/filter.module.ts +++ b/src/addons/filter/filter.module.ts @@ -47,4 +47,4 @@ import { AddonFilterUrlToLinkModule } from './urltolink/urltolink.module'; AddonFilterUrlToLinkModule, ], }) -export class AddonFilterModule { } +export class AddonFilterModule {} diff --git a/src/addons/messageoutput/airnotifier/airnotifier.module.ts b/src/addons/messageoutput/airnotifier/airnotifier.module.ts index 65fc244d6..a02f32d53 100644 --- a/src/addons/messageoutput/airnotifier/airnotifier.module.ts +++ b/src/addons/messageoutput/airnotifier/airnotifier.module.ts @@ -22,18 +22,22 @@ import { AddonMessageOutputAirnotifierHandlerService, } from './services/handlers/messageoutput'; import { AddonMessageOutputAirnotifier } from './services/airnotifier'; +import { CoreSharedModule } from '@/core/shared.module'; +import { AddonMessageOutputAirnotifierDevicesPage } from '@addons/messageoutput/airnotifier/pages/devices/devices'; const routes: Routes = [ { path: AddonMessageOutputAirnotifierHandlerService.PAGE_NAME, - loadChildren: () => import('./pages/devices/devices.module').then( m => m.AddonMessageOutputAirnotifierDevicesPageModule), + component: AddonMessageOutputAirnotifierDevicesPage, }, ]; @NgModule({ declarations: [ + AddonMessageOutputAirnotifierDevicesPage, ], imports: [ + CoreSharedModule, CoreMainMenuTabRoutingModule.forChild(routes), ], providers: [ diff --git a/src/addons/messageoutput/airnotifier/pages/devices/devices.module.ts b/src/addons/messageoutput/airnotifier/pages/devices/devices.module.ts deleted file mode 100644 index c191264ae..000000000 --- a/src/addons/messageoutput/airnotifier/pages/devices/devices.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { AddonMessageOutputAirnotifierDevicesPage } from './devices'; - -const routes: Routes = [ - { - path: '', - component: AddonMessageOutputAirnotifierDevicesPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - AddonMessageOutputAirnotifierDevicesPage, - ], - exports: [RouterModule], -}) -export class AddonMessageOutputAirnotifierDevicesPageModule {} diff --git a/src/addons/messages/messages-lazy.module.ts b/src/addons/messages/messages-lazy.module.ts index 88b9d4d25..39fef0ea5 100644 --- a/src/addons/messages/messages-lazy.module.ts +++ b/src/addons/messages/messages-lazy.module.ts @@ -12,55 +12,112 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { conditionalRoutes } from '@/app/app-routing.module'; +import { CoreSharedModule } from '@/core/shared.module'; +import { AddonMessagesContacts35Page } from '@addons/messages/pages/contacts-35/contacts'; +import { AddonMessagesContactsPage } from '@addons/messages/pages/contacts/contacts'; +import { AddonMessagesDiscussionPage } from '@addons/messages/pages/discussion/discussion'; +import { AddonMessagesDiscussions35Page } from '@addons/messages/pages/discussions-35/discussions'; +import { AddonMessagesGroupConversationsPage } from '@addons/messages/pages/group-conversations/group-conversations'; +import { AddonMessagesSearchPage } from '@addons/messages/pages/search/search'; +import { AddonMessagesMainMenuHandlerService } from '@addons/messages/services/handlers/mainmenu'; import { Injector, NgModule } from '@angular/core'; import { Route, RouterModule, ROUTES, Routes } from '@angular/router'; +import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/components.module'; import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.module'; +import { CoreSearchComponentsModule } from '@features/search/components/components.module'; +import { CoreScreen } from '@services/screen'; import { AddonMessagesIndexGuard } from './guards'; -export const DISCUSSION_ROUTES: Route[] = [ - { - path: 'discussion/user/:userId', - loadChildren: () => import('./pages/discussion/discussion.module') - .then(m => m.AddonMessagesDiscussionPageModule), - }, - { - path: 'discussion/:conversationId', - loadChildren: () => import('./pages/discussion/discussion.module') - .then(m => m.AddonMessagesDiscussionPageModule), - }, -]; - +/** + * Build module routes. + * + * @param injector Injector. + * @returns Routes. + */ function buildRoutes(injector: Injector): Routes { - return [ + const discussionRoutes: Route[] = [ { - path: 'index', // 3.5. - loadChildren: () => - import('./pages/discussions-35/discussions.module').then(m => m.AddonMessagesDiscussions35PageModule), + path: 'discussion/user/:userId', + component: AddonMessagesDiscussionPage, + }, + { + path: 'discussion/:conversationId', + component: AddonMessagesDiscussionPage, + }, + ]; + + const mobileRoutes: Routes = [ + { + path: 'contacts', // 3.6 or greater. + component: AddonMessagesContactsPage, + }, + { + path: 'index', + data: { mainMenuTabRoot: AddonMessagesMainMenuHandlerService.PAGE_NAME }, + component: AddonMessagesDiscussions35Page, }, { path: 'contacts-35', // 3.5. - loadChildren: () => import('./pages/contacts-35/contacts.module').then(m => m.AddonMessagesContacts35PageModule), + component: AddonMessagesContacts35Page, }, { path: 'group-conversations', // 3.6 or greater. - loadChildren: () => import('./pages/group-conversations/group-conversations.module') - .then(m => m.AddonMessagesGroupConversationsPageModule), + data: { mainMenuTabRoot: AddonMessagesMainMenuHandlerService.PAGE_NAME }, + component: AddonMessagesGroupConversationsPage, }, - ...DISCUSSION_ROUTES, { path: 'search', - loadChildren: () => import('./pages/search/search.module') - .then(m => m.AddonMessagesSearchPageModule), + component: AddonMessagesSearchPage, }, + ] + .reduce((routes, mobileRoute) => [ + ...routes, + mobileRoute, + ...discussionRoutes.map(discussionRoute => ({ + ...discussionRoute, + path: `${mobileRoute.path}/${discussionRoute.path}`, + })), + ], []); + + const tabletRoutes: Routes = [ { path: 'contacts', // 3.6 or greater. - loadChildren: () => import('./pages/contacts/contacts.module') - .then(m => m.AddonMessagesContactsPageModule), + component: AddonMessagesContactsPage, + children: discussionRoutes, }, + { + path: 'index', + data: { mainMenuTabRoot: AddonMessagesMainMenuHandlerService.PAGE_NAME }, + component: AddonMessagesDiscussions35Page, + children: discussionRoutes, + }, + { + path: 'contacts-35', // 3.5. + component: AddonMessagesContacts35Page, + children: discussionRoutes, + }, + { + path: 'group-conversations', // 3.6 or greater. + data: { mainMenuTabRoot: AddonMessagesMainMenuHandlerService.PAGE_NAME }, + component: AddonMessagesGroupConversationsPage, + children: discussionRoutes, + }, + { + path: 'search', + component: AddonMessagesSearchPage, + children: discussionRoutes, + }, + ]; + + return [ + ...conditionalRoutes(mobileRoutes, () => CoreScreen.isMobile), + ...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet), + ...discussionRoutes, { path: 'message-settings', - loadChildren: () => import('./pages/settings/settings.module').then(m => m.AddonMessagesSettingsPageModule), + loadChildren: () => import('./messages-settings-lazy.module').then(m => m.AddonMessagesSettingsLazyModule), }, ...buildTabMainRoutes(injector, { canActivate: [AddonMessagesIndexGuard], @@ -69,6 +126,19 @@ function buildRoutes(injector: Injector): Routes { } @NgModule({ + imports: [ + CoreSharedModule, + CoreSearchComponentsModule, + CoreMainMenuComponentsModule, + ], + declarations: [ + AddonMessagesContacts35Page, + AddonMessagesContactsPage, + AddonMessagesDiscussionPage, + AddonMessagesDiscussions35Page, + AddonMessagesGroupConversationsPage, + AddonMessagesSearchPage, + ], exports: [RouterModule], providers: [ { @@ -79,4 +149,4 @@ function buildRoutes(injector: Injector): Routes { }, ], }) -export class AddonMessagesLazyModule { } +export class AddonMessagesLazyModule {} diff --git a/src/addons/messages/pages/settings/settings.module.ts b/src/addons/messages/messages-settings-lazy.module.ts similarity index 88% rename from src/addons/messages/pages/settings/settings.module.ts rename to src/addons/messages/messages-settings-lazy.module.ts index 560ee1bf9..0bebb54e4 100644 --- a/src/addons/messages/pages/settings/settings.module.ts +++ b/src/addons/messages/messages-settings-lazy.module.ts @@ -16,8 +16,7 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; - -import { AddonMessagesSettingsPage } from './settings.page'; +import { AddonMessagesSettingsPage } from '@addons/messages/pages/settings/settings'; const routes: Routes = [ { @@ -36,4 +35,4 @@ const routes: Routes = [ ], exports: [RouterModule], }) -export class AddonMessagesSettingsPageModule {} +export class AddonMessagesSettingsLazyModule {} diff --git a/src/addons/messages/messages.module.ts b/src/addons/messages/messages.module.ts index 80e3875d8..c6579af46 100644 --- a/src/addons/messages/messages.module.ts +++ b/src/addons/messages/messages.module.ts @@ -36,7 +36,7 @@ import { NgZone } from '@singletons'; import { CoreNetwork } from '@services/network'; import { AddonMessagesSync, AddonMessagesSyncProvider } from './services/messages-sync'; import { AddonMessagesSyncCronHandler } from './services/handlers/sync-cron'; -import { CoreSitePreferencesRoutingModule } from '@features/settings/pages/site/site-routing'; +import { CoreSitePreferencesRoutingModule } from '@features/settings/settings-site-routing.module'; import { AddonMessagesProvider } from './services/messages'; import { AddonMessagesOfflineProvider } from './services/messages-offline'; @@ -55,7 +55,7 @@ const mainMenuChildrenRoutes: Routes = [ const preferencesRoutes: Routes = [ { path: AddonMessagesSettingsHandlerService.PAGE_NAME, - loadChildren: () => import('./pages/settings/settings.module').then(m => m.AddonMessagesSettingsPageModule), + loadChildren: () => import('./messages-settings-lazy.module').then(m => m.AddonMessagesSettingsLazyModule), }, ]; diff --git a/src/addons/messages/pages/contacts-35/contacts.module.ts b/src/addons/messages/pages/contacts-35/contacts.module.ts deleted file mode 100644 index 9a9752f5d..000000000 --- a/src/addons/messages/pages/contacts-35/contacts.module.ts +++ /dev/null @@ -1,58 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { conditionalRoutes } from '@/app/app-routing.module'; -import { DISCUSSION_ROUTES } from '@addons/messages/messages-lazy.module'; -import { CoreScreen } from '@services/screen'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreSearchComponentsModule } from '@features/search/components/components.module'; - -import { AddonMessagesContacts35Page } from './contacts.page'; - -const mobileRoutes: Routes = [ - { - path: '', - component: AddonMessagesContacts35Page, - }, - ...DISCUSSION_ROUTES, -]; - -const tabletRoutes: Routes = [ - { - path: '', - component: AddonMessagesContacts35Page, - children: DISCUSSION_ROUTES, - }, -]; - -const routes: Routes = [ - ...conditionalRoutes(mobileRoutes, () => CoreScreen.isMobile), - ...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet), -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreSearchComponentsModule, - ], - declarations: [ - AddonMessagesContacts35Page, - ], - exports: [RouterModule], -}) -export class AddonMessagesContacts35PageModule {} diff --git a/src/addons/messages/pages/contacts-35/contacts.page.ts b/src/addons/messages/pages/contacts-35/contacts.ts similarity index 100% rename from src/addons/messages/pages/contacts-35/contacts.page.ts rename to src/addons/messages/pages/contacts-35/contacts.ts diff --git a/src/addons/messages/pages/contacts/contacts.module.ts b/src/addons/messages/pages/contacts/contacts.module.ts deleted file mode 100644 index b3325270f..000000000 --- a/src/addons/messages/pages/contacts/contacts.module.ts +++ /dev/null @@ -1,56 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { conditionalRoutes } from '@/app/app-routing.module'; -import { DISCUSSION_ROUTES } from '@addons/messages/messages-lazy.module'; -import { CoreScreen } from '@services/screen'; - -import { CoreSharedModule } from '@/core/shared.module'; - -import { AddonMessagesContactsPage } from './contacts.page'; - -const mobileRoutes: Routes = [ - { - path: '', - component: AddonMessagesContactsPage, - }, - ...DISCUSSION_ROUTES, -]; - -const tabletRoutes: Routes = [ - { - path: '', - component: AddonMessagesContactsPage, - children: DISCUSSION_ROUTES, - }, -]; - -const routes: Routes = [ - ...conditionalRoutes(mobileRoutes, () => CoreScreen.isMobile), - ...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet), -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - AddonMessagesContactsPage, - ], - exports: [RouterModule], -}) -export class AddonMessagesContactsPageModule {} diff --git a/src/addons/messages/pages/contacts/contacts.page.ts b/src/addons/messages/pages/contacts/contacts.ts similarity index 100% rename from src/addons/messages/pages/contacts/contacts.page.ts rename to src/addons/messages/pages/contacts/contacts.ts diff --git a/src/addons/messages/pages/discussion/discussion.module.ts b/src/addons/messages/pages/discussion/discussion.module.ts deleted file mode 100644 index d247c53b2..000000000 --- a/src/addons/messages/pages/discussion/discussion.module.ts +++ /dev/null @@ -1,41 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; - -import { AddonMessagesDiscussionPage } from './discussion.page'; -import { AddonMessagesComponentsModule } from '@addons/messages/components/components.module'; - -const routes: Routes = [ - { - path: '', - component: AddonMessagesDiscussionPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - AddonMessagesComponentsModule, - ], - declarations: [ - AddonMessagesDiscussionPage, - ], - exports: [RouterModule], -}) -export class AddonMessagesDiscussionPageModule {} diff --git a/src/addons/messages/pages/discussion/discussion.page.ts b/src/addons/messages/pages/discussion/discussion.ts similarity index 100% rename from src/addons/messages/pages/discussion/discussion.page.ts rename to src/addons/messages/pages/discussion/discussion.ts diff --git a/src/addons/messages/pages/discussions-35/discussions.module.ts b/src/addons/messages/pages/discussions-35/discussions.module.ts deleted file mode 100644 index a721b573b..000000000 --- a/src/addons/messages/pages/discussions-35/discussions.module.ts +++ /dev/null @@ -1,67 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { CoreScreen } from '@services/screen'; -import { conditionalRoutes } from '@/app/app-routing.module'; -import { DISCUSSION_ROUTES } from '@addons/messages/messages-lazy.module'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreSearchComponentsModule } from '@features/search/components/components.module'; - -import { AddonMessagesDiscussions35Page } from './discussions.page'; -import { AddonMessagesMainMenuHandlerService } from '@addons/messages/services/handlers/mainmenu'; -import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/components.module'; - -const mobileRoutes: Routes = [ - { - path: '', - data: { - mainMenuTabRoot: AddonMessagesMainMenuHandlerService.PAGE_NAME, - }, - component: AddonMessagesDiscussions35Page, - }, - ...DISCUSSION_ROUTES, -]; - -const tabletRoutes: Routes = [ - { - path: '', - data: { - mainMenuTabRoot: AddonMessagesMainMenuHandlerService.PAGE_NAME, - }, - component: AddonMessagesDiscussions35Page, - children: DISCUSSION_ROUTES, - }, -]; - -const routes: Routes = [ - ...conditionalRoutes(mobileRoutes, () => CoreScreen.isMobile), - ...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet), -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreSearchComponentsModule, - CoreMainMenuComponentsModule, - ], - declarations: [ - AddonMessagesDiscussions35Page, - ], - exports: [RouterModule], -}) -export class AddonMessagesDiscussions35PageModule {} diff --git a/src/addons/messages/pages/discussions-35/discussions.page.ts b/src/addons/messages/pages/discussions-35/discussions.ts similarity index 100% rename from src/addons/messages/pages/discussions-35/discussions.page.ts rename to src/addons/messages/pages/discussions-35/discussions.ts diff --git a/src/addons/messages/pages/group-conversations/group-conversations.module.ts b/src/addons/messages/pages/group-conversations/group-conversations.module.ts deleted file mode 100644 index 88cd32835..000000000 --- a/src/addons/messages/pages/group-conversations/group-conversations.module.ts +++ /dev/null @@ -1,65 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { conditionalRoutes } from '@/app/app-routing.module'; -import { DISCUSSION_ROUTES } from '@addons/messages/messages-lazy.module'; -import { CoreScreen } from '@services/screen'; - -import { CoreSharedModule } from '@/core/shared.module'; - -import { AddonMessagesGroupConversationsPage } from './group-conversations.page'; -import { AddonMessagesMainMenuHandlerService } from '@addons/messages/services/handlers/mainmenu'; -import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/components.module'; - -const mobileRoutes: Routes = [ - { - path: '', - data: { - mainMenuTabRoot: AddonMessagesMainMenuHandlerService.PAGE_NAME, - }, - component: AddonMessagesGroupConversationsPage, - }, - ...DISCUSSION_ROUTES, -]; - -const tabletRoutes: Routes = [ - { - path: '', - data: { - mainMenuTabRoot: AddonMessagesMainMenuHandlerService.PAGE_NAME, - }, - component: AddonMessagesGroupConversationsPage, - children: DISCUSSION_ROUTES, - }, -]; - -const routes: Routes = [ - ...conditionalRoutes(mobileRoutes, () => CoreScreen.isMobile), - ...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet), -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreMainMenuComponentsModule, - ], - declarations: [ - AddonMessagesGroupConversationsPage, - ], - exports: [RouterModule], -}) -export class AddonMessagesGroupConversationsPageModule {} diff --git a/src/addons/messages/pages/group-conversations/group-conversations.page.ts b/src/addons/messages/pages/group-conversations/group-conversations.ts similarity index 100% rename from src/addons/messages/pages/group-conversations/group-conversations.page.ts rename to src/addons/messages/pages/group-conversations/group-conversations.ts diff --git a/src/addons/messages/pages/search/search.module.ts b/src/addons/messages/pages/search/search.module.ts deleted file mode 100644 index 24337c262..000000000 --- a/src/addons/messages/pages/search/search.module.ts +++ /dev/null @@ -1,58 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { CoreScreen } from '@services/screen'; -import { conditionalRoutes } from '@/app/app-routing.module'; -import { DISCUSSION_ROUTES } from '@addons/messages/messages-lazy.module'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreSearchComponentsModule } from '@features/search/components/components.module'; - -import { AddonMessagesSearchPage } from './search.page'; - -const mobileRoutes: Routes = [ - { - path: '', - component: AddonMessagesSearchPage, - }, - ...DISCUSSION_ROUTES, -]; - -const tabletRoutes: Routes = [ - { - path: '', - component: AddonMessagesSearchPage, - children: DISCUSSION_ROUTES, - }, -]; - -const routes: Routes = [ - ...conditionalRoutes(mobileRoutes, () => CoreScreen.isMobile), - ...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet), -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreSearchComponentsModule, - ], - declarations: [ - AddonMessagesSearchPage, - ], - exports: [RouterModule], -}) -export class AddonMessagesSearchPageModule {} diff --git a/src/addons/messages/pages/search/search.page.ts b/src/addons/messages/pages/search/search.ts similarity index 100% rename from src/addons/messages/pages/search/search.page.ts rename to src/addons/messages/pages/search/search.ts diff --git a/src/addons/messages/pages/settings/settings.page.ts b/src/addons/messages/pages/settings/settings.ts similarity index 100% rename from src/addons/messages/pages/settings/settings.page.ts rename to src/addons/messages/pages/settings/settings.ts diff --git a/src/addons/mod/assign/assign-lazy.module.ts b/src/addons/mod/assign/assign-lazy.module.ts index 67dde44fd..c8dbb6778 100644 --- a/src/addons/mod/assign/assign-lazy.module.ts +++ b/src/addons/mod/assign/assign-lazy.module.ts @@ -20,8 +20,8 @@ import { CanLeaveGuard } from '@guards/can-leave'; import { CoreScreen } from '@services/screen'; import { AddonModAssignComponentsModule } from './components/components.module'; import { AddonModAssignEditPage } from './pages/edit/edit'; -import { AddonModAssignIndexPage } from './pages/index/index.page'; -import { AddonModAssignSubmissionListPage } from './pages/submission-list/submission-list.page'; +import { AddonModAssignIndexPage } from './pages/index'; +import { AddonModAssignSubmissionListPage } from './pages/submission-list/submission-list'; import { AddonModAssignSubmissionReviewPage } from './pages/submission-review/submission-review'; const commonRoutes: Routes = [ diff --git a/src/addons/mod/assign/feedback/feedback.module.ts b/src/addons/mod/assign/feedback/feedback.module.ts index dd76de25c..566de0839 100644 --- a/src/addons/mod/assign/feedback/feedback.module.ts +++ b/src/addons/mod/assign/feedback/feedback.module.ts @@ -24,4 +24,4 @@ import { AddonModAssignFeedbackFileModule } from './file/file.module'; AddonModAssignFeedbackFileModule, ], }) -export class AddonModAssignFeedbackModule { } +export class AddonModAssignFeedbackModule {} diff --git a/src/addons/mod/assign/pages/index/index.page.ts b/src/addons/mod/assign/pages/index/index.ts similarity index 100% rename from src/addons/mod/assign/pages/index/index.page.ts rename to src/addons/mod/assign/pages/index/index.ts diff --git a/src/addons/mod/assign/pages/submission-list/submission-list.page.ts b/src/addons/mod/assign/pages/submission-list/submission-list.ts similarity index 100% rename from src/addons/mod/assign/pages/submission-list/submission-list.page.ts rename to src/addons/mod/assign/pages/submission-list/submission-list.ts diff --git a/src/addons/mod/assign/submission/submission.module.ts b/src/addons/mod/assign/submission/submission.module.ts index cb01e8e7c..028637669 100644 --- a/src/addons/mod/assign/submission/submission.module.ts +++ b/src/addons/mod/assign/submission/submission.module.ts @@ -24,4 +24,4 @@ import { AddonModAssignSubmissionOnlineTextModule } from './onlinetext/onlinetex AddonModAssignSubmissionOnlineTextModule, ], }) -export class AddonModAssignSubmissionModule { } +export class AddonModAssignSubmissionModule {} diff --git a/src/addons/mod/book/book-lazy.module.ts b/src/addons/mod/book/book-lazy.module.ts index 0c81566fc..43b4af496 100644 --- a/src/addons/mod/book/book-lazy.module.ts +++ b/src/addons/mod/book/book-lazy.module.ts @@ -16,7 +16,9 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; import { AddonModBookComponentsModule } from './components/components.module'; -import { AddonModBookIndexPage } from './pages/index/index.page'; +import { AddonModBookIndexPage } from './pages/index'; +import { CoreTagComponentsModule } from '@features/tag/components/components.module'; +import { AddonModBookContentsPage } from '@addons/mod/book/pages/contents/contents'; const routes: Routes = [ { @@ -25,7 +27,7 @@ const routes: Routes = [ }, { path: ':courseId/:cmId/contents', - loadChildren: () => import('./pages/contents/contents.module').then(m => m.AddonModBookContentsPageModule), + component: AddonModBookContentsPage, }, ]; @@ -34,9 +36,11 @@ const routes: Routes = [ RouterModule.forChild(routes), CoreSharedModule, AddonModBookComponentsModule, + CoreTagComponentsModule, ], declarations: [ AddonModBookIndexPage, + AddonModBookContentsPage, ], }) export class AddonModBookLazyModule {} diff --git a/src/addons/mod/book/pages/contents/contents.module.ts b/src/addons/mod/book/pages/contents/contents.module.ts deleted file mode 100644 index 2c2bea53c..000000000 --- a/src/addons/mod/book/pages/contents/contents.module.ts +++ /dev/null @@ -1,40 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { AddonModBookContentsPage } from './contents'; -import { CoreTagComponentsModule } from '@features/tag/components/components.module'; - -const routes: Routes = [ - { - path: '', - component: AddonModBookContentsPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreTagComponentsModule, - ], - declarations: [ - AddonModBookContentsPage, - ], - exports: [RouterModule], -}) -export class AddonModBookContentsPageModule {} diff --git a/src/addons/mod/book/pages/index/index.page.ts b/src/addons/mod/book/pages/index/index.ts similarity index 100% rename from src/addons/mod/book/pages/index/index.page.ts rename to src/addons/mod/book/pages/index/index.ts diff --git a/src/addons/mod/data/fields/field.module.ts b/src/addons/mod/data/fields/field.module.ts index 293e00baf..b1aa25258 100644 --- a/src/addons/mod/data/fields/field.module.ts +++ b/src/addons/mod/data/fields/field.module.ts @@ -42,4 +42,4 @@ import { AddonModDataFieldUrlModule } from './url/url.module'; AddonModDataFieldUrlModule, ], }) -export class AddonModDataFieldModule { } +export class AddonModDataFieldModule {} diff --git a/src/addons/mod/feedback/feedback-lazy.module.ts b/src/addons/mod/feedback/feedback-lazy.module.ts index b055ceedd..660c257ce 100644 --- a/src/addons/mod/feedback/feedback-lazy.module.ts +++ b/src/addons/mod/feedback/feedback-lazy.module.ts @@ -20,6 +20,10 @@ import { AddonModFeedbackIndexPage } from './pages/index/index'; import { AddonModFeedbackAttemptsPage } from './pages/attempts/attempts'; import { conditionalRoutes } from '@/app/app-routing.module'; import { CoreScreen } from '@services/screen'; +import { AddonModFeedbackAttemptPage } from '@addons/mod/feedback/pages/attempt/attempt'; +import { AddonModFeedbackFormPage } from '@addons/mod/feedback/pages/form/form'; +import { CanLeaveGuard } from '@guards/can-leave'; +import { AddonModFeedbackNonRespondentsPage } from '@addons/mod/feedback/pages/nonrespondents/nonrespondents'; const commonRoutes: Routes = [ { @@ -28,12 +32,12 @@ const commonRoutes: Routes = [ }, { path: ':courseId/:cmId/form', - loadChildren: () => import('./pages/form/form.module').then(m => m.AddonModFeedbackFormPageModule), + component: AddonModFeedbackFormPage, + canDeactivate: [CanLeaveGuard], }, { path: ':courseId/:cmId/nonrespondents', - loadChildren: () => import('./pages/nonrespondents/nonrespondents.module') - .then(m => m.AddonModFeedbackNonRespondentsPageModule), + component: AddonModFeedbackNonRespondentsPage, }, ]; @@ -45,7 +49,7 @@ const mobileRoutes: Routes = [ }, { path: ':courseId/:cmId/attempts/:attemptId', - loadChildren: () => import('./pages/attempt/attempt.module').then(m => m.AddonModFeedbackAttemptPageModule), + component: AddonModFeedbackAttemptPage, }, ]; @@ -57,7 +61,7 @@ const tabletRoutes: Routes = [ children: [ { path: ':attemptId', - loadChildren: () => import('./pages/attempt/attempt.module').then(m => m.AddonModFeedbackAttemptPageModule), + component: AddonModFeedbackAttemptPage, }, ], }, @@ -75,8 +79,11 @@ const routes: Routes = [ AddonModFeedbackComponentsModule, ], declarations: [ - AddonModFeedbackIndexPage, AddonModFeedbackAttemptsPage, + AddonModFeedbackFormPage, + AddonModFeedbackIndexPage, + AddonModFeedbackNonRespondentsPage, + AddonModFeedbackAttemptPage, ], }) export class AddonModFeedbackLazyModule {} diff --git a/src/addons/mod/feedback/pages/attempt/attempt.module.ts b/src/addons/mod/feedback/pages/attempt/attempt.module.ts deleted file mode 100644 index 788d1664a..000000000 --- a/src/addons/mod/feedback/pages/attempt/attempt.module.ts +++ /dev/null @@ -1,37 +0,0 @@ -// (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. - -import { CoreSharedModule } from '@/core/shared.module'; -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { AddonModFeedbackAttemptPage } from './attempt'; - -const routes: Routes = [ - { - path: '', - component: AddonModFeedbackAttemptPage, - }, -]; - -@NgModule({ - declarations: [ - AddonModFeedbackAttemptPage, - ], - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - exports: [RouterModule], -}) -export class AddonModFeedbackAttemptPageModule {} diff --git a/src/addons/mod/feedback/pages/form/form.module.ts b/src/addons/mod/feedback/pages/form/form.module.ts deleted file mode 100644 index 9dd8eea72..000000000 --- a/src/addons/mod/feedback/pages/form/form.module.ts +++ /dev/null @@ -1,39 +0,0 @@ -// (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. - -import { CoreSharedModule } from '@/core/shared.module'; -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { CanLeaveGuard } from '@guards/can-leave'; -import { AddonModFeedbackFormPage } from './form'; - -const routes: Routes = [ - { - path: '', - component: AddonModFeedbackFormPage, - canDeactivate: [CanLeaveGuard], - }, -]; - -@NgModule({ - declarations: [ - AddonModFeedbackFormPage, - ], - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - exports: [RouterModule], -}) -export class AddonModFeedbackFormPageModule {} diff --git a/src/addons/mod/feedback/pages/nonrespondents/nonrespondents.module.ts b/src/addons/mod/feedback/pages/nonrespondents/nonrespondents.module.ts deleted file mode 100644 index 654d85141..000000000 --- a/src/addons/mod/feedback/pages/nonrespondents/nonrespondents.module.ts +++ /dev/null @@ -1,37 +0,0 @@ -// (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. - -import { CoreSharedModule } from '@/core/shared.module'; -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { AddonModFeedbackNonRespondentsPage } from './nonrespondents'; - -const routes: Routes = [ - { - path: '', - component: AddonModFeedbackNonRespondentsPage, - }, -]; - -@NgModule({ - declarations: [ - AddonModFeedbackNonRespondentsPage, - ], - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - exports: [RouterModule], -}) -export class AddonModFeedbackNonRespondentsPageModule {} diff --git a/src/addons/mod/folder/folder-lazy.module.ts b/src/addons/mod/folder/folder-lazy.module.ts index 55748b89d..ab66c8051 100644 --- a/src/addons/mod/folder/folder-lazy.module.ts +++ b/src/addons/mod/folder/folder-lazy.module.ts @@ -18,7 +18,7 @@ import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; import { AddonModFolderComponentsModule } from './components/components.module'; -import { AddonModFolderIndexPage } from './pages/index/index.page'; +import { AddonModFolderIndexPage } from './pages/index'; const routes: Routes = [ { diff --git a/src/addons/mod/folder/pages/index/index.page.ts b/src/addons/mod/folder/pages/index/index.ts similarity index 99% rename from src/addons/mod/folder/pages/index/index.page.ts rename to src/addons/mod/folder/pages/index/index.ts index ccae8215f..174a4e4ef 100644 --- a/src/addons/mod/folder/pages/index/index.page.ts +++ b/src/addons/mod/folder/pages/index/index.ts @@ -15,7 +15,7 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { CoreCourseModuleMainActivityPage } from '@features/course/classes/main-activity-page'; import { CoreNavigator } from '@services/navigator'; -import { AddonModFolderIndexComponent } from '../../components/index'; +import { AddonModFolderIndexComponent } from '../../components/index/index'; import { AddonModFolderFolder } from '../../services/folder'; import { AddonModFolderFolderFormattedData } from '../../services/folder-helper'; diff --git a/src/addons/mod/forum/components/post/post.ts b/src/addons/mod/forum/components/post/post.ts index cf60ebbce..33adf5ad1 100644 --- a/src/addons/mod/forum/components/post/post.ts +++ b/src/addons/mod/forum/components/post/post.ts @@ -50,7 +50,7 @@ import { AddonModForumPostOptionsMenuComponent } from '../post-options-menu/post import { CoreRatingInfo } from '@features/rating/services/rating'; import { CoreForms } from '@singletons/form'; import { CoreFileEntry } from '@services/file-helper'; -import { AddonModForumSharedPostFormData } from '../../pages/discussion/discussion.page'; +import { AddonModForumSharedPostFormData } from '../../pages/discussion/discussion'; import { CoreDom } from '@singletons/dom'; /** diff --git a/src/addons/mod/forum/pages/discussion/discussion.module.ts b/src/addons/mod/forum/forum-discussion-lazy.module.ts similarity index 89% rename from src/addons/mod/forum/pages/discussion/discussion.module.ts rename to src/addons/mod/forum/forum-discussion-lazy.module.ts index dbfb5f2a1..beb00dbb2 100644 --- a/src/addons/mod/forum/pages/discussion/discussion.module.ts +++ b/src/addons/mod/forum/forum-discussion-lazy.module.ts @@ -18,8 +18,7 @@ import { RouterModule, Routes } from '@angular/router'; import { AddonModForumComponentsModule } from '@addons/mod/forum/components/components.module'; import { CanLeaveGuard } from '@guards/can-leave'; import { CoreSharedModule } from '@/core/shared.module'; - -import { AddonModForumDiscussionPage } from './discussion.page'; +import { AddonModForumDiscussionPage } from '@addons/mod/forum/pages/discussion/discussion'; const routes: Routes = [{ path: '', @@ -37,4 +36,4 @@ const routes: Routes = [{ AddonModForumDiscussionPage, ], }) -export class AddonForumDiscussionPageModule {} +export class AddonForumDiscussionLazyModule {} diff --git a/src/addons/mod/forum/forum-lazy.module.ts b/src/addons/mod/forum/forum-lazy.module.ts index 121eda5c4..9acda2d6e 100644 --- a/src/addons/mod/forum/forum-lazy.module.ts +++ b/src/addons/mod/forum/forum-lazy.module.ts @@ -20,7 +20,7 @@ import { CoreScreen } from '@services/screen'; import { CoreSharedModule } from '@/core/shared.module'; import { AddonModForumComponentsModule } from './components/components.module'; -import { AddonModForumIndexPage } from './pages/index/index.page'; +import { AddonModForumIndexPage } from './pages/index'; const mobileRoutes: Routes = [ { @@ -29,15 +29,15 @@ const mobileRoutes: Routes = [ }, { path: ':courseId/:cmId/new/:timeCreated', - loadChildren: () => import('./pages/new-discussion/new-discussion.module').then(m => m.AddonForumNewDiscussionPageModule), + loadChildren: () => import('./forum-new-discussion-lazy.module').then(m => m.AddonForumNewDiscussionLazyModule), }, { path: ':courseId/:cmId/:discussionId', - loadChildren: () => import('./pages/discussion/discussion.module').then(m => m.AddonForumDiscussionPageModule), + loadChildren: () => import('./forum-discussion-lazy.module').then(m => m.AddonForumDiscussionLazyModule), }, { path: 'discussion/:discussionId', // Only for discussion link handling. - loadChildren: () => import('./pages/discussion/discussion.module').then(m => m.AddonForumDiscussionPageModule), + loadChildren: () => import('./forum-discussion-lazy.module').then(m => m.AddonForumDiscussionLazyModule), }, ]; @@ -48,13 +48,11 @@ const tabletRoutes: Routes = [ children: [ { path: 'new/:timeCreated', - loadChildren: () => import('./pages/new-discussion/new-discussion.module') - .then(m => m.AddonForumNewDiscussionPageModule), + loadChildren: () => import('./forum-new-discussion-lazy.module').then(m => m.AddonForumNewDiscussionLazyModule), }, { path: ':discussionId', - loadChildren: () => import('./pages/discussion/discussion.module').then(m => m.AddonForumDiscussionPageModule), - + loadChildren: () => import('./forum-discussion-lazy.module').then(m => m.AddonForumDiscussionLazyModule), }, ], }, diff --git a/src/addons/mod/forum/pages/new-discussion/new-discussion.module.ts b/src/addons/mod/forum/forum-new-discussion-lazy.module.ts similarity index 89% rename from src/addons/mod/forum/pages/new-discussion/new-discussion.module.ts rename to src/addons/mod/forum/forum-new-discussion-lazy.module.ts index 7cbde9b15..07024b705 100644 --- a/src/addons/mod/forum/pages/new-discussion/new-discussion.module.ts +++ b/src/addons/mod/forum/forum-new-discussion-lazy.module.ts @@ -19,8 +19,7 @@ import { AddonModForumComponentsModule } from '@addons/mod/forum/components/comp import { CanLeaveGuard } from '@guards/can-leave'; import { CoreEditorComponentsModule } from '@features/editor/components/components.module'; import { CoreSharedModule } from '@/core/shared.module'; - -import { AddonModForumNewDiscussionPage } from './new-discussion.page'; +import { AddonModForumNewDiscussionPage } from '@addons/mod/forum/pages/new-discussion/new-discussion'; const routes: Routes = [{ path: '', @@ -39,4 +38,4 @@ const routes: Routes = [{ AddonModForumNewDiscussionPage, ], }) -export class AddonForumNewDiscussionPageModule {} +export class AddonForumNewDiscussionLazyModule {} diff --git a/src/addons/mod/forum/forum.module.ts b/src/addons/mod/forum/forum.module.ts index 1db80bdb1..ce2f0533b 100644 --- a/src/addons/mod/forum/forum.module.ts +++ b/src/addons/mod/forum/forum.module.ts @@ -17,7 +17,7 @@ import { Routes } from '@angular/router'; import { conditionalRoutes } from '@/app/app-routing.module'; import { CORE_SITE_SCHEMAS } from '@services/sites'; -import { CoreCourseContentsRoutingModule } from '@features/course/pages/contents/contents-routing.module'; +import { CoreCourseContentsRoutingModule } from '@features/course/course-contents-routing.module'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreScreen } from '@services/screen'; @@ -55,7 +55,7 @@ export const ADDON_MOD_FORUM_SERVICES: Type[] = [ const mainMenuRoutes: Routes = [ { path: `${AddonModForumModuleHandlerService.PAGE_NAME}/discussion/:discussionId`, - loadChildren: () => import('./pages/discussion/discussion.module').then(m => m.AddonForumDiscussionPageModule), + loadChildren: () => import('./forum-discussion-lazy.module').then(m => m.AddonForumDiscussionLazyModule), data: { swipeEnabled: false }, }, { @@ -66,13 +66,12 @@ const mainMenuRoutes: Routes = [ [ { path: `${COURSE_CONTENTS_PATH}/${AddonModForumModuleHandlerService.PAGE_NAME}/new/:timeCreated`, - loadChildren: () => import('./pages/new-discussion/new-discussion.module') - .then(m => m.AddonForumNewDiscussionPageModule), + loadChildren: () => import('./forum-new-discussion-lazy.module').then(m => m.AddonForumNewDiscussionLazyModule), data: { discussionsPathPrefix: `${AddonModForumModuleHandlerService.PAGE_NAME}/` }, }, { path: `${COURSE_CONTENTS_PATH}/${AddonModForumModuleHandlerService.PAGE_NAME}/:discussionId`, - loadChildren: () => import('./pages/discussion/discussion.module').then(m => m.AddonForumDiscussionPageModule), + loadChildren: () => import('./forum-discussion-lazy.module').then(m => m.AddonForumDiscussionLazyModule), data: { discussionsPathPrefix: `${AddonModForumModuleHandlerService.PAGE_NAME}/` }, }, ], @@ -84,13 +83,12 @@ const courseContentsRoutes: Routes = conditionalRoutes( [ { path: `${AddonModForumModuleHandlerService.PAGE_NAME}/new/:timeCreated`, - loadChildren: () => import('./pages/new-discussion/new-discussion.module') - .then(m => m.AddonForumNewDiscussionPageModule), + loadChildren: () => import('./forum-new-discussion-lazy.module').then(m => m.AddonForumNewDiscussionLazyModule), data: { discussionsPathPrefix: `${AddonModForumModuleHandlerService.PAGE_NAME}/` }, }, { path: `${AddonModForumModuleHandlerService.PAGE_NAME}/:discussionId`, - loadChildren: () => import('./pages/discussion/discussion.module').then(m => m.AddonForumDiscussionPageModule), + loadChildren: () => import('./forum-discussion-lazy.module').then(m => m.AddonForumDiscussionLazyModule), data: { discussionsPathPrefix: `${AddonModForumModuleHandlerService.PAGE_NAME}/` }, }, ], diff --git a/src/addons/mod/forum/pages/discussion/discussion.page.ts b/src/addons/mod/forum/pages/discussion/discussion.ts similarity index 100% rename from src/addons/mod/forum/pages/discussion/discussion.page.ts rename to src/addons/mod/forum/pages/discussion/discussion.ts diff --git a/src/addons/mod/forum/pages/index/index.page.ts b/src/addons/mod/forum/pages/index/index.ts similarity index 98% rename from src/addons/mod/forum/pages/index/index.page.ts rename to src/addons/mod/forum/pages/index/index.ts index e930a0ae3..d917ce243 100644 --- a/src/addons/mod/forum/pages/index/index.page.ts +++ b/src/addons/mod/forum/pages/index/index.ts @@ -15,7 +15,7 @@ import { Component, ViewChild } from '@angular/core'; import { CoreCourseModuleMainActivityPage } from '@features/course/classes/main-activity-page'; -import { AddonModForumIndexComponent } from '../../components/index'; +import { AddonModForumIndexComponent } from '../../components/index/index'; @Component({ selector: 'page-addon-mod-forum-index', diff --git a/src/addons/mod/forum/pages/new-discussion/new-discussion.page.ts b/src/addons/mod/forum/pages/new-discussion/new-discussion.ts similarity index 100% rename from src/addons/mod/forum/pages/new-discussion/new-discussion.page.ts rename to src/addons/mod/forum/pages/new-discussion/new-discussion.ts diff --git a/src/addons/mod/glossary/pages/edit/edit.module.ts b/src/addons/mod/glossary/glossary-edit-lazy.module.ts similarity index 90% rename from src/addons/mod/glossary/pages/edit/edit.module.ts rename to src/addons/mod/glossary/glossary-edit-lazy.module.ts index 1ff7808da..990aa6b2c 100644 --- a/src/addons/mod/glossary/pages/edit/edit.module.ts +++ b/src/addons/mod/glossary/glossary-edit-lazy.module.ts @@ -13,11 +13,11 @@ // limitations under the License. import { NgModule } from '@angular/core'; -import { AddonModGlossaryEditPage } from './edit'; import { CoreSharedModule } from '@/core/shared.module'; import { CoreEditorComponentsModule } from '@features/editor/components/components.module'; import { RouterModule, Routes } from '@angular/router'; import { CanLeaveGuard } from '@guards/can-leave'; +import { AddonModGlossaryEditPage } from '@addons/mod/glossary/pages/edit/edit'; const routes: Routes = [{ path: '', @@ -35,4 +35,4 @@ const routes: Routes = [{ CoreEditorComponentsModule, ], }) -export class AddonModGlossaryEditPageModule {} +export class AddonModGlossaryEditLazyModule {} diff --git a/src/addons/mod/glossary/pages/entry/entry.module.ts b/src/addons/mod/glossary/glossary-entry-lazy.module.ts similarity index 91% rename from src/addons/mod/glossary/pages/entry/entry.module.ts rename to src/addons/mod/glossary/glossary-entry-lazy.module.ts index 24da954a9..781b896f5 100644 --- a/src/addons/mod/glossary/pages/entry/entry.module.ts +++ b/src/addons/mod/glossary/glossary-entry-lazy.module.ts @@ -14,11 +14,11 @@ import { NgModule } from '@angular/core'; import { CoreSharedModule } from '@/core/shared.module'; -import { AddonModGlossaryEntryPage } from './entry'; import { CoreCommentsComponentsModule } from '@features/comments/components/components.module'; import { CoreRatingComponentsModule } from '@features/rating/components/components.module'; import { CoreTagComponentsModule } from '@features/tag/components/components.module'; import { RouterModule, Routes } from '@angular/router'; +import { AddonModGlossaryEntryPage } from '@addons/mod/glossary/pages/entry/entry'; const routes: Routes = [{ path: '', @@ -37,4 +37,4 @@ const routes: Routes = [{ CoreTagComponentsModule, ], }) -export class AddonModGlossaryEntryPageModule {} +export class AddonModGlossaryEntryLazyModule {} diff --git a/src/addons/mod/glossary/glossary-lazy.module.ts b/src/addons/mod/glossary/glossary-lazy.module.ts index c05d7af3f..c96ce6e7d 100644 --- a/src/addons/mod/glossary/glossary-lazy.module.ts +++ b/src/addons/mod/glossary/glossary-lazy.module.ts @@ -28,11 +28,11 @@ const mobileRoutes: Routes = [ }, { path: ':courseId/:cmId/entry/:entryId', - loadChildren: () => import('./pages/entry/entry.module').then(m => m.AddonModGlossaryEntryPageModule), + loadChildren: () => import('./glossary-entry-lazy.module').then(m => m.AddonModGlossaryEntryLazyModule), }, { path: ':courseId/:cmId/edit/:timecreated', - loadChildren: () => import('./pages/edit/edit.module').then(m => m.AddonModGlossaryEditPageModule), + loadChildren: () => import('./glossary-edit-lazy.module').then(m => m.AddonModGlossaryEditLazyModule), }, ]; @@ -43,11 +43,11 @@ const tabletRoutes: Routes = [ children: [ { path: 'entry/:entryId', - loadChildren: () => import('./pages/entry/entry.module').then(m => m.AddonModGlossaryEntryPageModule), + loadChildren: () => import('./glossary-entry-lazy.module').then(m => m.AddonModGlossaryEntryLazyModule), }, { path: 'edit/:timecreated', - loadChildren: () => import('./pages/edit/edit.module').then(m => m.AddonModGlossaryEditPageModule), + loadChildren: () => import('./glossary-edit-lazy.module').then(m => m.AddonModGlossaryEditLazyModule), }, ], }, diff --git a/src/addons/mod/glossary/glossary.module.ts b/src/addons/mod/glossary/glossary.module.ts index 67b00d1be..82def7f99 100644 --- a/src/addons/mod/glossary/glossary.module.ts +++ b/src/addons/mod/glossary/glossary.module.ts @@ -17,7 +17,7 @@ import { APP_INITIALIZER, NgModule, Type } from '@angular/core'; import { Routes } from '@angular/router'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; import { COURSE_CONTENTS_PATH } from '@features/course/course.module'; -import { CoreCourseContentsRoutingModule } from '@features/course/pages/contents/contents-routing.module'; +import { CoreCourseContentsRoutingModule } from '@features/course/course-contents-routing.module'; import { CoreCourseHelper } from '@features/course/services/course-helper'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; import { CoreCourseModulePrefetchDelegate } from '@features/course/services/module-prefetch-delegate'; @@ -51,12 +51,12 @@ export const ADDON_MOD_GLOSSARY_SERVICES: Type[] = [ const mainMenuRoutes: Routes = [ { path: `${AddonModGlossaryModuleHandlerService.PAGE_NAME}/entry/:entryId`, - loadChildren: () => import('./pages/entry/entry.module').then(m => m.AddonModGlossaryEntryPageModule), + loadChildren: () => import('./glossary-entry-lazy.module').then(m => m.AddonModGlossaryEntryLazyModule), data: { swipeEnabled: false }, }, { path: `${AddonModGlossaryModuleHandlerService.PAGE_NAME}/edit/:timecreated`, - loadChildren: () => import('./pages/edit/edit.module').then(m => m.AddonModGlossaryEditPageModule), + loadChildren: () => import('./glossary-edit-lazy.module').then(m => m.AddonModGlossaryEditLazyModule), data: { swipeEnabled: false }, }, { @@ -67,12 +67,12 @@ const mainMenuRoutes: Routes = [ [ { path: `${COURSE_CONTENTS_PATH}/${AddonModGlossaryModuleHandlerService.PAGE_NAME}/entry/:entryId`, - loadChildren: () => import('./pages/entry/entry.module').then(m => m.AddonModGlossaryEntryPageModule), + loadChildren: () => import('./glossary-entry-lazy.module').then(m => m.AddonModGlossaryEntryLazyModule), data: { glossaryPathPrefix: `${AddonModGlossaryModuleHandlerService.PAGE_NAME}/` }, }, { path: `${COURSE_CONTENTS_PATH}/${AddonModGlossaryModuleHandlerService.PAGE_NAME}/edit/:timecreated`, - loadChildren: () => import('./pages/edit/edit.module').then(m => m.AddonModGlossaryEditPageModule), + loadChildren: () => import('./glossary-edit-lazy.module').then(m => m.AddonModGlossaryEditLazyModule), data: { glossaryPathPrefix: `${AddonModGlossaryModuleHandlerService.PAGE_NAME}/` }, }, ], @@ -84,12 +84,12 @@ const courseContentsRoutes: Routes = conditionalRoutes( [ { path: `${AddonModGlossaryModuleHandlerService.PAGE_NAME}/entry/:entryId`, - loadChildren: () => import('./pages/entry/entry.module').then(m => m.AddonModGlossaryEntryPageModule), + loadChildren: () => import('./glossary-entry-lazy.module').then(m => m.AddonModGlossaryEntryLazyModule), data: { glossaryPathPrefix: `${AddonModGlossaryModuleHandlerService.PAGE_NAME}/` }, }, { path: `${AddonModGlossaryModuleHandlerService.PAGE_NAME}/edit/:timecreated`, - loadChildren: () => import('./pages/edit/edit.module').then(m => m.AddonModGlossaryEditPageModule), + loadChildren: () => import('./glossary-edit-lazy.module').then(m => m.AddonModGlossaryEditLazyModule), data: { glossaryPathPrefix: `${AddonModGlossaryModuleHandlerService.PAGE_NAME}/` }, }, ], diff --git a/src/addons/mod/h5pactivity/h5pactivity-lazy.module.ts b/src/addons/mod/h5pactivity/h5pactivity-lazy.module.ts index 3ac3e9562..39999538a 100644 --- a/src/addons/mod/h5pactivity/h5pactivity-lazy.module.ts +++ b/src/addons/mod/h5pactivity/h5pactivity-lazy.module.ts @@ -19,6 +19,9 @@ import { CoreSharedModule } from '@/core/shared.module'; import { CanLeaveGuard } from '@guards/can-leave'; import { AddonModH5PActivityComponentsModule } from './components/components.module'; import { AddonModH5PActivityIndexPage } from './pages/index/index'; +import { AddonModH5PActivityUserAttemptsPage } from '@addons/mod/h5pactivity/pages/user-attempts/user-attempts'; +import { AddonModH5PActivityAttemptResultsPage } from '@addons/mod/h5pactivity/pages/attempt-results/attempt-results'; +import { AddonModH5PActivityUsersAttemptsPage } from '@addons/mod/h5pactivity/pages/users-attempts/users-attempts'; const routes: Routes = [ { @@ -28,18 +31,15 @@ const routes: Routes = [ }, { path: ':courseId/:cmId/userattempts/:userId', - loadChildren: () => import('./pages/user-attempts/user-attempts.module') - .then( m => m.AddonModH5PActivityUserAttemptsPageModule), + component: AddonModH5PActivityUserAttemptsPage, }, { path: ':courseId/:cmId/attemptresults/:attemptId', - loadChildren: () => import('./pages/attempt-results/attempt-results.module') - .then( m => m.AddonModH5PActivityAttemptResultsPageModule), + component: AddonModH5PActivityAttemptResultsPage, }, { path: ':courseId/:cmId/users', - loadChildren: () => import('./pages/users-attempts/users-attempts.module') - .then( m => m.AddonModH5PActivityUsersAttemptsPageModule), + component: AddonModH5PActivityUsersAttemptsPage, }, ]; @@ -51,6 +51,9 @@ const routes: Routes = [ ], declarations: [ AddonModH5PActivityIndexPage, + AddonModH5PActivityUserAttemptsPage, + AddonModH5PActivityAttemptResultsPage, + AddonModH5PActivityUsersAttemptsPage, ], }) export class AddonModH5PActivityLazyModule {} diff --git a/src/addons/mod/h5pactivity/pages/attempt-results/attempt-results.module.ts b/src/addons/mod/h5pactivity/pages/attempt-results/attempt-results.module.ts deleted file mode 100644 index f8560683d..000000000 --- a/src/addons/mod/h5pactivity/pages/attempt-results/attempt-results.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { AddonModH5PActivityAttemptResultsPage } from './attempt-results'; - -const routes: Routes = [ - { - path: '', - component: AddonModH5PActivityAttemptResultsPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - AddonModH5PActivityAttemptResultsPage, - ], - exports: [RouterModule], -}) -export class AddonModH5PActivityAttemptResultsPageModule {} diff --git a/src/addons/mod/h5pactivity/pages/user-attempts/user-attempts.module.ts b/src/addons/mod/h5pactivity/pages/user-attempts/user-attempts.module.ts deleted file mode 100644 index 810cf13f3..000000000 --- a/src/addons/mod/h5pactivity/pages/user-attempts/user-attempts.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { AddonModH5PActivityUserAttemptsPage } from './user-attempts'; - -const routes: Routes = [ - { - path: '', - component: AddonModH5PActivityUserAttemptsPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - AddonModH5PActivityUserAttemptsPage, - ], - exports: [RouterModule], -}) -export class AddonModH5PActivityUserAttemptsPageModule {} diff --git a/src/addons/mod/h5pactivity/pages/users-attempts/users-attempts.module.ts b/src/addons/mod/h5pactivity/pages/users-attempts/users-attempts.module.ts deleted file mode 100644 index c09f58954..000000000 --- a/src/addons/mod/h5pactivity/pages/users-attempts/users-attempts.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { AddonModH5PActivityUsersAttemptsPage } from './users-attempts'; - -const routes: Routes = [ - { - path: '', - component: AddonModH5PActivityUsersAttemptsPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - AddonModH5PActivityUsersAttemptsPage, - ], - exports: [RouterModule], -}) -export class AddonModH5PActivityUsersAttemptsPageModule {} diff --git a/src/addons/mod/imscp/imscp-lazy.module.ts b/src/addons/mod/imscp/imscp-lazy.module.ts index 1fb94112d..1ef464bb7 100644 --- a/src/addons/mod/imscp/imscp-lazy.module.ts +++ b/src/addons/mod/imscp/imscp-lazy.module.ts @@ -17,7 +17,8 @@ import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; import { AddonModImscpComponentsModule } from './components/components.module'; -import { AddonModImscpIndexPage } from './pages/index/index.page'; +import { AddonModImscpIndexPage } from './pages/index/index'; +import { AddonModImscpViewPage } from '@addons/mod/imscp/pages/view/view'; const routes: Routes = [ { @@ -26,7 +27,7 @@ const routes: Routes = [ }, { path: ':courseId/:cmId/view', - loadChildren: () => import('./pages/view/view.module').then(m => m.AddonModImscpViewPageModule), + component: AddonModImscpViewPage, }, ]; @@ -38,6 +39,7 @@ const routes: Routes = [ ], declarations: [ AddonModImscpIndexPage, + AddonModImscpViewPage, ], }) export class AddonModImscpLazyModule {} diff --git a/src/addons/mod/imscp/pages/index/index.page.ts b/src/addons/mod/imscp/pages/index/index.ts similarity index 100% rename from src/addons/mod/imscp/pages/index/index.page.ts rename to src/addons/mod/imscp/pages/index/index.ts diff --git a/src/addons/mod/imscp/pages/view/view.module.ts b/src/addons/mod/imscp/pages/view/view.module.ts deleted file mode 100644 index a4232dac5..000000000 --- a/src/addons/mod/imscp/pages/view/view.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { AddonModImscpViewPage } from './view'; - -const routes: Routes = [ - { - path: '', - component: AddonModImscpViewPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - AddonModImscpViewPage, - ], - exports: [RouterModule], -}) -export class AddonModImscpViewPageModule {} diff --git a/src/addons/mod/lesson/components/menu-modal/menu-modal.ts b/src/addons/mod/lesson/components/menu-modal/menu-modal.ts index a5c31b8d2..73b257e79 100644 --- a/src/addons/mod/lesson/components/menu-modal/menu-modal.ts +++ b/src/addons/mod/lesson/components/menu-modal/menu-modal.ts @@ -15,7 +15,7 @@ import { Component, Input } from '@angular/core'; import { ModalController } from '@singletons'; -import { AddonModLessonPlayerPage } from '../../pages/player/player.page'; +import { AddonModLessonPlayerPage } from '../../pages/player/player'; /** * Modal that renders the lesson menu and media file. diff --git a/src/addons/mod/lesson/lesson-lazy.module.ts b/src/addons/mod/lesson/lesson-lazy.module.ts index db94d2ddb..880b69126 100644 --- a/src/addons/mod/lesson/lesson-lazy.module.ts +++ b/src/addons/mod/lesson/lesson-lazy.module.ts @@ -18,7 +18,11 @@ import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; import { AddonModLessonComponentsModule } from './components/components.module'; -import { AddonModLessonIndexPage } from './pages/index/index.page'; +import { AddonModLessonIndexPage } from './pages/index'; +import { CoreEditorComponentsModule } from '@features/editor/components/components.module'; +import { AddonModLessonPlayerPage } from '@addons/mod/lesson/pages/player/player'; +import { CanLeaveGuard } from '@guards/can-leave'; +import { AddonModLessonUserRetakePage } from '@addons/mod/lesson/pages/user-retake/user-retake'; const routes: Routes = [ { @@ -27,11 +31,12 @@ const routes: Routes = [ }, { path: ':courseId/:cmId/player', - loadChildren: () => import('./pages/player/player.module').then( m => m.AddonModLessonPlayerPageModule), + component: AddonModLessonPlayerPage, + canDeactivate: [CanLeaveGuard], }, { path: ':courseId/:cmId/user-retake/:userId', - loadChildren: () => import('./pages/user-retake/user-retake.module').then( m => m.AddonModLessonUserRetakePageModule), + component: AddonModLessonUserRetakePage, }, ]; @@ -39,10 +44,13 @@ const routes: Routes = [ imports: [ RouterModule.forChild(routes), CoreSharedModule, + CoreEditorComponentsModule, AddonModLessonComponentsModule, ], declarations: [ AddonModLessonIndexPage, + AddonModLessonPlayerPage, + AddonModLessonUserRetakePage, ], }) export class AddonModLessonLazyModule {} diff --git a/src/addons/mod/lesson/pages/index/index.page.ts b/src/addons/mod/lesson/pages/index/index.ts similarity index 100% rename from src/addons/mod/lesson/pages/index/index.page.ts rename to src/addons/mod/lesson/pages/index/index.ts diff --git a/src/addons/mod/lesson/pages/player/player.module.ts b/src/addons/mod/lesson/pages/player/player.module.ts deleted file mode 100644 index f70555e98..000000000 --- a/src/addons/mod/lesson/pages/player/player.module.ts +++ /dev/null @@ -1,42 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { AddonModLessonPlayerPage } from './player.page'; -import { CoreEditorComponentsModule } from '@features/editor/components/components.module'; -import { CanLeaveGuard } from '@guards/can-leave'; - -const routes: Routes = [ - { - path: '', - component: AddonModLessonPlayerPage, - canDeactivate: [CanLeaveGuard], - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreEditorComponentsModule, - ], - declarations: [ - AddonModLessonPlayerPage, - ], - exports: [RouterModule], -}) -export class AddonModLessonPlayerPageModule {} diff --git a/src/addons/mod/lesson/pages/player/player.page.ts b/src/addons/mod/lesson/pages/player/player.ts similarity index 100% rename from src/addons/mod/lesson/pages/player/player.page.ts rename to src/addons/mod/lesson/pages/player/player.ts diff --git a/src/addons/mod/lesson/pages/user-retake/user-retake.module.ts b/src/addons/mod/lesson/pages/user-retake/user-retake.module.ts deleted file mode 100644 index 198b8c222..000000000 --- a/src/addons/mod/lesson/pages/user-retake/user-retake.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { AddonModLessonUserRetakePage } from './user-retake.page'; - -const routes: Routes = [ - { - path: '', - component: AddonModLessonUserRetakePage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - AddonModLessonUserRetakePage, - ], - exports: [RouterModule], -}) -export class AddonModLessonUserRetakePageModule {} diff --git a/src/addons/mod/lesson/pages/user-retake/user-retake.page.ts b/src/addons/mod/lesson/pages/user-retake/user-retake.ts similarity index 100% rename from src/addons/mod/lesson/pages/user-retake/user-retake.page.ts rename to src/addons/mod/lesson/pages/user-retake/user-retake.ts diff --git a/src/addons/mod/lti/lti-lazy.module.ts b/src/addons/mod/lti/lti-lazy.module.ts index 163e70a80..8e172a28c 100644 --- a/src/addons/mod/lti/lti-lazy.module.ts +++ b/src/addons/mod/lti/lti-lazy.module.ts @@ -16,7 +16,7 @@ import { CoreSharedModule } from '@/core/shared.module'; import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { AddonModLtiComponentsModule } from './components/components.module'; -import { AddonModLtiIndexPage } from './pages/index/index.page'; +import { AddonModLtiIndexPage } from './pages/index'; const routes: Routes = [ { diff --git a/src/addons/mod/lti/pages/index/index.page.ts b/src/addons/mod/lti/pages/index/index.ts similarity index 100% rename from src/addons/mod/lti/pages/index/index.page.ts rename to src/addons/mod/lti/pages/index/index.ts diff --git a/src/addons/mod/mod.module.ts b/src/addons/mod/mod.module.ts index f5f039c55..1e3d73622 100644 --- a/src/addons/mod/mod.module.ts +++ b/src/addons/mod/mod.module.ts @@ -65,4 +65,4 @@ import { AddonModWorkshopModule } from './workshop/workshop.module'; AddonModWorkshopModule, ], }) -export class AddonModModule { } +export class AddonModModule {} diff --git a/src/addons/mod/page/page-lazy.module.ts b/src/addons/mod/page/page-lazy.module.ts index 1174401e2..e2e52badb 100644 --- a/src/addons/mod/page/page-lazy.module.ts +++ b/src/addons/mod/page/page-lazy.module.ts @@ -17,7 +17,7 @@ import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; import { AddonModPageComponentsModule } from './components/components.module'; -import { AddonModPageIndexPage } from './pages/index/index.page'; +import { AddonModPageIndexPage } from './pages/index'; const routes: Routes = [ { diff --git a/src/addons/mod/page/pages/index/index.page.ts b/src/addons/mod/page/pages/index/index.ts similarity index 100% rename from src/addons/mod/page/pages/index/index.page.ts rename to src/addons/mod/page/pages/index/index.ts diff --git a/src/addons/mod/quiz/accessrules/accessrules.module.ts b/src/addons/mod/quiz/accessrules/accessrules.module.ts index 6c4c8e2a5..7bbdc36a8 100644 --- a/src/addons/mod/quiz/accessrules/accessrules.module.ts +++ b/src/addons/mod/quiz/accessrules/accessrules.module.ts @@ -37,4 +37,4 @@ import { AddonModQuizAccessTimeLimitModule } from './timelimit/timelimit.module' AddonModQuizAccessTimeLimitModule, ], }) -export class AddonModQuizAccessRulesModule { } +export class AddonModQuizAccessRulesModule {} diff --git a/src/addons/mod/quiz/pages/attempt/attempt.module.ts b/src/addons/mod/quiz/pages/attempt/attempt.module.ts deleted file mode 100644 index c59d872db..000000000 --- a/src/addons/mod/quiz/pages/attempt/attempt.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { AddonModQuizAttemptPage } from './attempt.page'; - -const routes: Routes = [ - { - path: '', - component: AddonModQuizAttemptPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - AddonModQuizAttemptPage, - ], - exports: [RouterModule], -}) -export class AddonModQuizAttemptPageModule {} diff --git a/src/addons/mod/quiz/pages/attempt/attempt.page.ts b/src/addons/mod/quiz/pages/attempt/attempt.ts similarity index 100% rename from src/addons/mod/quiz/pages/attempt/attempt.page.ts rename to src/addons/mod/quiz/pages/attempt/attempt.ts diff --git a/src/addons/mod/quiz/pages/index/index.page.ts b/src/addons/mod/quiz/pages/index/index.ts similarity index 100% rename from src/addons/mod/quiz/pages/index/index.page.ts rename to src/addons/mod/quiz/pages/index/index.ts diff --git a/src/addons/mod/quiz/pages/player/player.module.ts b/src/addons/mod/quiz/pages/player/player.module.ts deleted file mode 100644 index 1273a9f42..000000000 --- a/src/addons/mod/quiz/pages/player/player.module.ts +++ /dev/null @@ -1,42 +0,0 @@ -// (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. - -import { CoreSharedModule } from '@/core/shared.module'; -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreQuestionComponentsModule } from '@features/question/components/components.module'; -import { CanLeaveGuard } from '@guards/can-leave'; -import { AddonModQuizPlayerPage } from './player.page'; - -const routes: Routes = [ - { - path: '', - component: AddonModQuizPlayerPage, - canDeactivate: [CanLeaveGuard], - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreQuestionComponentsModule, - ], - declarations: [ - AddonModQuizPlayerPage, - ], - exports: [RouterModule], -}) -export class AddonModQuizPlayerPageModule {} diff --git a/src/addons/mod/quiz/pages/player/player.page.ts b/src/addons/mod/quiz/pages/player/player.ts similarity index 100% rename from src/addons/mod/quiz/pages/player/player.page.ts rename to src/addons/mod/quiz/pages/player/player.ts diff --git a/src/addons/mod/quiz/pages/review/review.module.ts b/src/addons/mod/quiz/pages/review/review.module.ts deleted file mode 100644 index da7740455..000000000 --- a/src/addons/mod/quiz/pages/review/review.module.ts +++ /dev/null @@ -1,40 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreQuestionComponentsModule } from '@features/question/components/components.module'; -import { AddonModQuizReviewPage } from './review.page'; - -const routes: Routes = [ - { - path: '', - component: AddonModQuizReviewPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreQuestionComponentsModule, - ], - declarations: [ - AddonModQuizReviewPage, - ], - exports: [RouterModule], -}) -export class AddonModQuizReviewPageModule {} diff --git a/src/addons/mod/quiz/pages/review/review.page.ts b/src/addons/mod/quiz/pages/review/review.ts similarity index 100% rename from src/addons/mod/quiz/pages/review/review.page.ts rename to src/addons/mod/quiz/pages/review/review.ts diff --git a/src/addons/mod/quiz/quiz-lazy.module.ts b/src/addons/mod/quiz/quiz-lazy.module.ts index f239a0c04..36c01811e 100644 --- a/src/addons/mod/quiz/quiz-lazy.module.ts +++ b/src/addons/mod/quiz/quiz-lazy.module.ts @@ -18,7 +18,12 @@ import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; import { AddonModQuizComponentsModule } from './components/components.module'; -import { AddonModQuizIndexPage } from './pages/index/index.page'; +import { AddonModQuizIndexPage } from './pages/index'; +import { AddonModQuizAttemptPage } from '@addons/mod/quiz/pages/attempt/attempt'; +import { CoreQuestionComponentsModule } from '@features/question/components/components.module'; +import { AddonModQuizPlayerPage } from '@addons/mod/quiz/pages/player/player'; +import { CanLeaveGuard } from '@guards/can-leave'; +import { AddonModQuizReviewPage } from '@addons/mod/quiz/pages/review/review'; const routes: Routes = [ { @@ -27,15 +32,16 @@ const routes: Routes = [ }, { path: ':courseId/:cmId/player', - loadChildren: () => import('./pages/player/player.module').then( m => m.AddonModQuizPlayerPageModule), + component: AddonModQuizPlayerPage, + canDeactivate: [CanLeaveGuard], }, { path: ':courseId/:cmId/attempt/:attemptId', - loadChildren: () => import('./pages/attempt/attempt.module').then( m => m.AddonModQuizAttemptPageModule), + component: AddonModQuizAttemptPage, }, { path: ':courseId/:cmId/review/:attemptId', - loadChildren: () => import('./pages/review/review.module').then( m => m.AddonModQuizReviewPageModule), + component: AddonModQuizReviewPage, }, ]; @@ -44,9 +50,13 @@ const routes: Routes = [ RouterModule.forChild(routes), CoreSharedModule, AddonModQuizComponentsModule, + CoreQuestionComponentsModule, ], declarations: [ AddonModQuizIndexPage, + AddonModQuizAttemptPage, + AddonModQuizPlayerPage, + AddonModQuizReviewPage, ], }) export class AddonModQuizLazyModule {} diff --git a/src/addons/mod/resource/pages/index/index.page.ts b/src/addons/mod/resource/pages/index/index.ts similarity index 100% rename from src/addons/mod/resource/pages/index/index.page.ts rename to src/addons/mod/resource/pages/index/index.ts diff --git a/src/addons/mod/resource/resource-lazy.module.ts b/src/addons/mod/resource/resource-lazy.module.ts index 49354852a..d04baeef9 100644 --- a/src/addons/mod/resource/resource-lazy.module.ts +++ b/src/addons/mod/resource/resource-lazy.module.ts @@ -16,7 +16,7 @@ import { CoreSharedModule } from '@/core/shared.module'; import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { AddonModResourceComponentsModule } from './components/components.module'; -import { AddonModResourceIndexPage } from './pages/index/index.page'; +import { AddonModResourceIndexPage } from './pages/index'; const routes: Routes = [ { diff --git a/src/addons/mod/url/pages/index/index.page.ts b/src/addons/mod/url/pages/index/index.ts similarity index 100% rename from src/addons/mod/url/pages/index/index.page.ts rename to src/addons/mod/url/pages/index/index.ts diff --git a/src/addons/mod/url/url-lazy.module.ts b/src/addons/mod/url/url-lazy.module.ts index 5f159faf8..b6f4141c7 100644 --- a/src/addons/mod/url/url-lazy.module.ts +++ b/src/addons/mod/url/url-lazy.module.ts @@ -16,7 +16,7 @@ import { CoreSharedModule } from '@/core/shared.module'; import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { AddonModUrlComponentsModule } from './components/components.module'; -import { AddonModUrlIndexPage } from './pages/index/index.page'; +import { AddonModUrlIndexPage } from './pages/index'; const routes: Routes = [ { diff --git a/src/addons/notes/notes-lazy.module.ts b/src/addons/notes/notes-lazy.module.ts index cac3ef486..90203dd1d 100644 --- a/src/addons/notes/notes-lazy.module.ts +++ b/src/addons/notes/notes-lazy.module.ts @@ -17,7 +17,7 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { CoreCommentsComponentsModule } from '@features/comments/components/components.module'; import { CoreTagComponentsModule } from '@features/tag/components/components.module'; -import { AddonNotesListPage } from './pages/list/list.page'; +import { AddonNotesListPage } from './pages/list/list'; const routes: Routes = [ { diff --git a/src/addons/notes/notes.module.ts b/src/addons/notes/notes.module.ts index 5d82c91d1..a3b1ad092 100644 --- a/src/addons/notes/notes.module.ts +++ b/src/addons/notes/notes.module.ts @@ -27,7 +27,7 @@ import { NOTES_OFFLINE_SITE_SCHEMA } from './services/database/notes'; import { AddonNotesComponentsModule } from './components/components.module'; import { Routes } from '@angular/router'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; -import { CoreCourseIndexRoutingModule } from '@features/course/pages/index/index-routing.module'; +import { CoreCourseIndexRoutingModule } from '@features/course/course-routing.module'; // List of providers (without handlers). export const ADDON_NOTES_SERVICES: Type[] = [ diff --git a/src/addons/notes/pages/list/list.page.ts b/src/addons/notes/pages/list/list.ts similarity index 100% rename from src/addons/notes/pages/list/list.page.ts rename to src/addons/notes/pages/list/list.ts diff --git a/src/addons/notifications/notifications-lazy.module.ts b/src/addons/notifications/notifications-lazy.module.ts index 31928d31d..152192646 100644 --- a/src/addons/notifications/notifications-lazy.module.ts +++ b/src/addons/notifications/notifications-lazy.module.ts @@ -13,33 +13,45 @@ // limitations under the License. import { conditionalRoutes } from '@/app/app-routing.module'; +import { CoreSharedModule } from '@/core/shared.module'; +import { AddonNotificationsListPage } from '@addons/notifications/pages/list/list'; +import { AddonNotificationsNotificationPage } from '@addons/notifications/pages/notification/notification'; import { Injector, NgModule } from '@angular/core'; import { RouterModule, ROUTES, Routes } from '@angular/router'; +import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/components.module'; import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreScreen } from '@services/screen'; import { AddonNotificationsMainMenuHandlerService } from './services/handlers/mainmenu'; +/** + * Build module routes. + * + * @param injector Injector. + * @returns Routes. + */ function buildRoutes(injector: Injector): Routes { return [ { path: 'list', - data: { - mainMenuTabRoot: AddonNotificationsMainMenuHandlerService.PAGE_NAME, - }, - loadChildren: () => import('./pages/list/list.module').then(m => m.AddonNotificationsListPageModule), + data: { mainMenuTabRoot: AddonNotificationsMainMenuHandlerService.PAGE_NAME }, + component: AddonNotificationsListPage, + children: conditionalRoutes([ + { + path: ':id', + component: AddonNotificationsNotificationPage, + }, + ], () => CoreScreen.isTablet), }, ...conditionalRoutes([ { path: 'list/:id', - loadChildren: () => import('./pages/notification/notification.module') - .then(m => m.AddonNotificationsNotificationPageModule), + component: AddonNotificationsNotificationPage, }, ], () => CoreScreen.isMobile), { path: 'notification', - loadChildren: () => import('./pages/notification/notification.module') - .then(m => m.AddonNotificationsNotificationPageModule), + component: AddonNotificationsNotificationPage, }, ...buildTabMainRoutes(injector, { redirectTo: 'list', @@ -49,6 +61,14 @@ function buildRoutes(injector: Injector): Routes { } @NgModule({ + imports: [ + CoreSharedModule, + CoreMainMenuComponentsModule, + ], + declarations: [ + AddonNotificationsListPage, + AddonNotificationsNotificationPage, + ], exports: [RouterModule], providers: [ { diff --git a/src/addons/notifications/pages/settings/settings.module.ts b/src/addons/notifications/notifications-settings-lazy.module.ts similarity index 87% rename from src/addons/notifications/pages/settings/settings.module.ts rename to src/addons/notifications/notifications-settings-lazy.module.ts index 4116d6068..9c455d4ce 100644 --- a/src/addons/notifications/pages/settings/settings.module.ts +++ b/src/addons/notifications/notifications-settings-lazy.module.ts @@ -16,7 +16,7 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; -import { AddonNotificationsSettingsPage } from './settings'; +import { AddonNotificationsSettingsPage } from '@addons/notifications/pages/settings/settings'; const routes: Routes = [ { @@ -35,4 +35,4 @@ const routes: Routes = [ ], exports: [RouterModule], }) -export class AddonNotificationsSettingsPageModule {} +export class AddonNotificationsSettingsLazyModule {} diff --git a/src/addons/notifications/notifications.module.ts b/src/addons/notifications/notifications.module.ts index d62457eea..d9d8d9118 100644 --- a/src/addons/notifications/notifications.module.ts +++ b/src/addons/notifications/notifications.module.ts @@ -25,7 +25,7 @@ import { AddonNotificationsMainMenuHandler, AddonNotificationsMainMenuHandlerSer import { AddonNotificationsCronHandler } from './services/handlers/cron'; import { AddonNotificationsPushClickHandler } from './services/handlers/push-click'; import { AddonNotificationsSettingsHandler, AddonNotificationsSettingsHandlerService } from './services/handlers/settings'; -import { CoreSitePreferencesRoutingModule } from '@features/settings/pages/site/site-routing'; +import { CoreSitePreferencesRoutingModule } from '@features/settings/settings-site-routing.module'; import { AddonNotificationsProvider } from './services/notifications'; import { AddonNotificationsHelperProvider } from './services/notifications-helper'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; @@ -40,13 +40,13 @@ export const ADDON_NOTIFICATIONS_SERVICES: Type[] = [ const routes: Routes = [ { path: AddonNotificationsMainMenuHandlerService.PAGE_NAME, - loadChildren: () => import('@addons/notifications/notifications-lazy.module').then(m => m.AddonNotificationsLazyModule), + loadChildren: () => import('./notifications-lazy.module').then(m => m.AddonNotificationsLazyModule), }, ]; const preferencesRoutes: Routes = [ { path: AddonNotificationsSettingsHandlerService.PAGE_NAME, - loadChildren: () => import('./pages/settings/settings.module').then(m => m.AddonNotificationsSettingsPageModule), + loadChildren: () => import('./notifications-settings-lazy.module').then(m => m.AddonNotificationsSettingsLazyModule), }, ]; diff --git a/src/addons/notifications/pages/list/list.module.ts b/src/addons/notifications/pages/list/list.module.ts deleted file mode 100644 index 62ffcd9c7..000000000 --- a/src/addons/notifications/pages/list/list.module.ts +++ /dev/null @@ -1,49 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { AddonNotificationsListPage } from './list'; -import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/components.module'; -import { conditionalRoutes } from '@/app/app-routing.module'; -import { CoreScreen } from '@services/screen'; - -const routes: Routes = [ - { - path: '', - component: AddonNotificationsListPage, - children: conditionalRoutes([ - { - path: ':id', - loadChildren: () => import('../../pages/notification/notification.module') - .then(m => m.AddonNotificationsNotificationPageModule), - }, - ], () => CoreScreen.isTablet), - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreMainMenuComponentsModule, - ], - declarations: [ - AddonNotificationsListPage, - ], - exports: [RouterModule], -}) -export class AddonNotificationsListPageModule {} diff --git a/src/addons/notifications/pages/notification/notification.module.ts b/src/addons/notifications/pages/notification/notification.module.ts deleted file mode 100644 index e16e2860b..000000000 --- a/src/addons/notifications/pages/notification/notification.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { AddonNotificationsNotificationPage } from './notification'; - -const routes: Routes = [ - { - path: '', - component: AddonNotificationsNotificationPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - AddonNotificationsNotificationPage, - ], - exports: [RouterModule], -}) -export class AddonNotificationsNotificationPageModule {} diff --git a/src/addons/privatefiles/pages/index/index.module.ts b/src/addons/privatefiles/pages/index/index.module.ts deleted file mode 100644 index 5bdc20d57..000000000 --- a/src/addons/privatefiles/pages/index/index.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { AddonPrivateFilesIndexPage } from '.'; - -const routes: Routes = [ - { - path: '', - component: AddonPrivateFilesIndexPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - AddonPrivateFilesIndexPage, - ], - exports: [RouterModule], -}) -export class AddonPrivateFilesIndexPageModule {} diff --git a/src/addons/privatefiles/privatefiles-lazy.module.ts b/src/addons/privatefiles/privatefiles-lazy.module.ts index a5a507655..43af7745a 100644 --- a/src/addons/privatefiles/privatefiles-lazy.module.ts +++ b/src/addons/privatefiles/privatefiles-lazy.module.ts @@ -12,20 +12,28 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { CoreSharedModule } from '@/core/shared.module'; +import { AddonPrivateFilesIndexPage } from '@addons/privatefiles/pages/index'; import { Injector, NgModule } from '@angular/core'; import { RouterModule, ROUTES, Routes } from '@angular/router'; import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.module'; +/** + * Build module routes. + * + * @param injector Injector. + * @returns Routes. + */ function buildRoutes(injector: Injector): Routes { return [ { path: 'root', - loadChildren: () => import('./pages/index/index.module').then(m => m.AddonPrivateFilesIndexPageModule), + component: AddonPrivateFilesIndexPage, }, { path: ':hash', - loadChildren: () => import('./pages/index/index.module').then(m => m.AddonPrivateFilesIndexPageModule), + component: AddonPrivateFilesIndexPage, }, ...buildTabMainRoutes(injector, { redirectTo: 'root', @@ -35,6 +43,12 @@ function buildRoutes(injector: Injector): Routes { } @NgModule({ + imports: [ + CoreSharedModule, + ], + declarations: [ + AddonPrivateFilesIndexPage, + ], exports: [RouterModule], providers: [ { diff --git a/src/addons/qbehaviour/qbehaviour.module.ts b/src/addons/qbehaviour/qbehaviour.module.ts index ab148e0e0..95713df72 100644 --- a/src/addons/qbehaviour/qbehaviour.module.ts +++ b/src/addons/qbehaviour/qbehaviour.module.ts @@ -39,4 +39,4 @@ import { AddonQbehaviourManualGradedModule } from './manualgraded/manualgraded.m AddonQbehaviourManualGradedModule, ], }) -export class AddonQbehaviourModule { } +export class AddonQbehaviourModule {} diff --git a/src/addons/qtype/qtype.module.ts b/src/addons/qtype/qtype.module.ts index bd7730bf4..a51925082 100644 --- a/src/addons/qtype/qtype.module.ts +++ b/src/addons/qtype/qtype.module.ts @@ -51,4 +51,4 @@ import { AddonQtypeTrueFalseModule } from './truefalse/truefalse.module'; AddonQtypeTrueFalseModule, ], }) -export class AddonQtypeModule { } +export class AddonQtypeModule {} diff --git a/src/addons/report/report.module.ts b/src/addons/report/report.module.ts index e544caede..9b580d0ff 100644 --- a/src/addons/report/report.module.ts +++ b/src/addons/report/report.module.ts @@ -20,4 +20,4 @@ import { AddonReportInsightsModule } from './insights/insights.module'; AddonReportInsightsModule, ], }) -export class AddonReportModule { } +export class AddonReportModule {} diff --git a/src/addons/storagemanager/storagemanager.module.ts b/src/addons/storagemanager/storagemanager.module.ts index fbf97bdaf..82f6d5e8b 100644 --- a/src/addons/storagemanager/storagemanager.module.ts +++ b/src/addons/storagemanager/storagemanager.module.ts @@ -16,7 +16,7 @@ import { NgModule, APP_INITIALIZER } from '@angular/core'; import { Routes } from '@angular/router'; import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; -import { CoreSitePreferencesRoutingModule } from '@features/settings/pages/site/site-routing'; +import { CoreSitePreferencesRoutingModule } from '@features/settings/settings-site-routing.module'; import { CoreSettingsDelegate } from '@features/settings/services/settings-delegate'; import { AddonStorageManagerSettingsHandler } from './services/handlers/settings'; diff --git a/src/addons/userprofilefield/userprofilefield.module.ts b/src/addons/userprofilefield/userprofilefield.module.ts index 3ddecabfc..90769bc4a 100644 --- a/src/addons/userprofilefield/userprofilefield.module.ts +++ b/src/addons/userprofilefield/userprofilefield.module.ts @@ -29,4 +29,4 @@ import { AddonUserProfileFieldTextModule } from './text/text.module'; AddonUserProfileFieldTextModule, ], }) -export class AddonUserProfileFieldModule { } +export class AddonUserProfileFieldModule {} diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index b3887aa41..0fca8968a 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -97,6 +97,12 @@ function buildConditionalUrlMatcher(pathOrMatcher: string | UrlMatcher, conditio }; } +/** + * Build url matcher using a regular expression. + * + * @param regexp Regular expression. + * @returns Url matcher. + */ export function buildRegExpUrlMatcher(regexp: RegExp): UrlMatcher { return (segments: UrlSegment[]): UrlMatchResult | null => { // Ignore empty paths. @@ -142,10 +148,15 @@ export function conditionalRoutes(routes: Routes, condition: () => boolean): Rou return routes.map(route => { // We need to remove the path from the route because Angular doesn't call the matcher for empty paths. const { path, matcher, ...newRoute } = route; + const matcherOrPath = matcher ?? path; + + if (matcherOrPath === undefined) { + throw new Error('Route defined without matcher nor path'); + } return { ...newRoute, - matcher: buildConditionalUrlMatcher(matcher || path || '', condition), + matcher: buildConditionalUrlMatcher(matcherOrPath, condition), }; }); } diff --git a/src/core/features/comments/comments-lazy.module.ts b/src/core/features/comments/comments-lazy.module.ts index 252225814..efce272c0 100644 --- a/src/core/features/comments/comments-lazy.module.ts +++ b/src/core/features/comments/comments-lazy.module.ts @@ -12,17 +12,25 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { CoreSharedModule } from '@/core/shared.module'; import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { CoreCommentsViewerPage } from '@features/comments/pages/viewer/viewer'; const routes: Routes = [ { path: ':contextLevel/:instanceId/:componentName/:itemId', - loadChildren: () => import('./pages/viewer/viewer.module').then( m => m.CoreCommentsViewerPageModule), + component: CoreCommentsViewerPage, }, ]; @NgModule({ - imports: [RouterModule.forChild(routes)], + imports: [ + RouterModule.forChild(routes), + CoreSharedModule, + ], + declarations: [ + CoreCommentsViewerPage, + ], }) export class CoreCommentsLazyModule {} diff --git a/src/core/features/comments/pages/viewer/viewer.module.ts b/src/core/features/comments/pages/viewer/viewer.module.ts deleted file mode 100644 index f4da73230..000000000 --- a/src/core/features/comments/pages/viewer/viewer.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreCommentsViewerPage } from './viewer.page'; - -const routes: Routes = [ - { - path: '', - component: CoreCommentsViewerPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - CoreCommentsViewerPage, - ], - exports: [RouterModule], -}) -export class CoreCommentsViewerPageModule {} diff --git a/src/core/features/comments/pages/viewer/viewer.page.ts b/src/core/features/comments/pages/viewer/viewer.ts similarity index 100% rename from src/core/features/comments/pages/viewer/viewer.page.ts rename to src/core/features/comments/pages/viewer/viewer.ts diff --git a/src/core/features/course/pages/contents/contents.module.ts b/src/core/features/course/course-contents-lazy.module.ts similarity index 79% rename from src/core/features/course/pages/contents/contents.module.ts rename to src/core/features/course/course-contents-lazy.module.ts index 54b6f07fb..d5b6f9aa1 100644 --- a/src/core/features/course/pages/contents/contents.module.ts +++ b/src/core/features/course/course-contents-lazy.module.ts @@ -17,13 +17,17 @@ import { RouterModule, ROUTES, Routes } from '@angular/router'; import { CoreCourseComponentsModule } from '@features/course/components/components.module'; import { CoreSharedModule } from '@/core/shared.module'; -import { resolveModuleRoutes } from '@/app/app-routing.module'; - -import { CoreCourseContentsPage } from './contents'; -import { COURSE_CONTENTS_ROUTES } from './contents-routing.module'; +import { resolveContentsRoutes } from '@features/course/course-contents-routing.module'; +import { CoreCourseContentsPage } from '@features/course/pages/contents/contents'; +/** + * Build module routes. + * + * @param injector Injector. + * @returns Routes. + */ function buildRoutes(injector: Injector): Routes { - const routes = resolveModuleRoutes(injector, COURSE_CONTENTS_ROUTES); + const routes = resolveContentsRoutes(injector); return [ { @@ -48,4 +52,4 @@ function buildRoutes(injector: Injector): Routes { ], exports: [RouterModule], }) -export class CoreCourseContentsPageModule {} +export class CoreCourseContentsLazyModule {} diff --git a/src/core/features/course/pages/contents/contents-routing.module.ts b/src/core/features/course/course-contents-routing.module.ts similarity index 66% rename from src/core/features/course/pages/contents/contents-routing.module.ts rename to src/core/features/course/course-contents-routing.module.ts index 2a5dcf26b..13be468f7 100644 --- a/src/core/features/course/pages/contents/contents-routing.module.ts +++ b/src/core/features/course/course-contents-routing.module.ts @@ -12,11 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { InjectionToken, ModuleWithProviders, NgModule } from '@angular/core'; +import { InjectionToken, Injector, ModuleWithProviders, NgModule } from '@angular/core'; -import { ModuleRoutesConfig } from '@/app/app-routing.module'; +import { ModuleRoutes, ModuleRoutesConfig, resolveModuleRoutes } from '@/app/app-routing.module'; -export const COURSE_CONTENTS_ROUTES = new InjectionToken('COURSE_CONTENTS_ROUTES'); +const COURSE_CONTENTS_ROUTES = new InjectionToken('COURSE_CONTENTS_ROUTES'); + +/** + * Resolve dynamic routes. + * + * @param injector Injector. + * @returns Module routes. + */ +export function resolveContentsRoutes(injector: Injector): ModuleRoutes { + return resolveModuleRoutes(injector, COURSE_CONTENTS_ROUTES); +} @NgModule() export class CoreCourseContentsRoutingModule { diff --git a/src/core/features/course/course-lazy.module.ts b/src/core/features/course/course-lazy.module.ts index f3698f814..c706c4240 100644 --- a/src/core/features/course/course-lazy.module.ts +++ b/src/core/features/course/course-lazy.module.ts @@ -12,33 +12,77 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; +import { CoreSharedModule } from '@/core/shared.module'; +import { Injector, NgModule } from '@angular/core'; +import { RouterModule, ROUTES, Routes } from '@angular/router'; +import { CoreCourseComponentsModule } from '@features/course/components/components.module'; +import { resolveIndexRoutes } from '@features/course/course-routing.module'; +import { CoreCourseSummaryPageModule } from '@features/course/pages/course-summary/course-summary.module'; +import { CoreCourseIndexPage } from '@features/course/pages/index'; +import { CoreCourseListModTypePage } from '@features/course/pages/list-mod-type/list-mod-type'; +import { CoreCourseModulePreviewPage } from '@features/course/pages/module-preview/module-preview'; import { CoreCourseHelper } from './services/course-helper'; export const COURSE_INDEX_PATH = ':courseId'; -const routes: Routes = [ - { - path: COURSE_INDEX_PATH, - loadChildren: () => import('./pages/index/index.module').then( m => m.CoreCourseIndexPageModule), - }, - { - path: ':courseId/:cmId/module-preview', - loadChildren: () => import('./pages/module-preview/module-preview.module') - .then( m => m.CoreCourseModulePreviewPageModule), - }, - { - path: ':courseId/list-mod-type', - loadChildren: () => import('./pages/list-mod-type/list-mod-type.module').then(m => m.CoreCourseListModTypePageModule), - }, - { - path: ':courseId/summary', - loadChildren: () => CoreCourseHelper.getCourseSummaryRouteModule(), - }, -]; +/** + * Build module routes. + * + * @param injector Injector. + * @returns Routes. + */ +function buildRoutes(injector: Injector): Routes { + const indexRoutes = resolveIndexRoutes(injector); + + return [ + { + path: COURSE_INDEX_PATH, + children: [ + { + path: '', + component: CoreCourseIndexPage, + data: { + isCourseIndex: true, + }, + children: indexRoutes.children, + }, + ...indexRoutes.siblings, + ], + }, + { + path: ':courseId/:cmId/module-preview', + component: CoreCourseModulePreviewPage, + }, + { + path: ':courseId/list-mod-type', + component: CoreCourseListModTypePage, + }, + { + path: ':courseId/summary', + loadChildren: () => CoreCourseHelper.getCourseSummaryRouteModule(), + }, + ]; +} @NgModule({ - imports: [RouterModule.forChild(routes)], + declarations: [ + CoreCourseListModTypePage, + CoreCourseIndexPage, + CoreCourseModulePreviewPage, + ], + imports: [ + CoreSharedModule, + CoreCourseComponentsModule, + CoreCourseSummaryPageModule, + ], + exports: [RouterModule], + providers: [ + { + provide: ROUTES, + multi: true, + deps: [Injector], + useFactory: buildRoutes, + }, + ], }) export class CoreCourseLazyModule {} diff --git a/src/core/features/course/pages/index/index-routing.module.ts b/src/core/features/course/course-routing.module.ts similarity index 66% rename from src/core/features/course/pages/index/index-routing.module.ts rename to src/core/features/course/course-routing.module.ts index 993f6f662..fe338a57d 100644 --- a/src/core/features/course/pages/index/index-routing.module.ts +++ b/src/core/features/course/course-routing.module.ts @@ -12,11 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { InjectionToken, ModuleWithProviders, NgModule } from '@angular/core'; +import { InjectionToken, Injector, ModuleWithProviders, NgModule } from '@angular/core'; -import { ModuleRoutesConfig } from '@/app/app-routing.module'; +import { ModuleRoutes, ModuleRoutesConfig, resolveModuleRoutes } from '@/app/app-routing.module'; -export const COURSE_INDEX_ROUTES = new InjectionToken('COURSE_INDEX_ROUTES'); +const COURSE_INDEX_ROUTES = new InjectionToken('COURSE_INDEX_ROUTES'); + +/** + * Resolve dynamic routes. + * + * @param injector Injector. + * @returns Module routes. + */ +export function resolveIndexRoutes(injector: Injector): ModuleRoutes { + return resolveModuleRoutes(injector, COURSE_INDEX_ROUTES); +} @NgModule() export class CoreCourseIndexRoutingModule { diff --git a/src/addons/calendar/pages/day/day.module.ts b/src/core/features/course/course-summary-lazy.module.ts similarity index 66% rename from src/addons/calendar/pages/day/day.module.ts rename to src/core/features/course/course-summary-lazy.module.ts index 2b197adc2..22ff6911c 100644 --- a/src/addons/calendar/pages/day/day.module.ts +++ b/src/core/features/course/course-summary-lazy.module.ts @@ -16,14 +16,14 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; -import { AddonCalendarComponentsModule } from '../../components/components.module'; - -import { AddonCalendarDayPage } from './day.page'; +import { CoreRemindersComponentsModule } from '@features/reminders/components/components.module'; +import { CoreCourseSummaryPage } from '@features/course/pages/course-summary/course-summary.page'; +import { CoreCourseSummaryPageModule } from '@features/course/pages/course-summary/course-summary.module'; const routes: Routes = [ { path: '', - component: AddonCalendarDayPage, + component: CoreCourseSummaryPage, }, ]; @@ -31,11 +31,9 @@ const routes: Routes = [ imports: [ RouterModule.forChild(routes), CoreSharedModule, - AddonCalendarComponentsModule, - ], - declarations: [ - AddonCalendarDayPage, + CoreRemindersComponentsModule, + CoreCourseSummaryPageModule, ], exports: [RouterModule], }) -export class AddonCalendarDayPageModule {} +export class CoreCourseSummaryLazyModule {} diff --git a/src/core/features/course/course.module.ts b/src/core/features/course/course.module.ts index 906b0df92..3f43fed5f 100644 --- a/src/core/features/course/course.module.ts +++ b/src/core/features/course/course.module.ts @@ -17,13 +17,10 @@ import { Routes } from '@angular/router'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CORE_SITE_SCHEMAS } from '@services/sites'; -import { CoreCourseComponentsModule } from './components/components.module'; -import { CoreCourseDirectivesModule } from './directives/directives.module'; -import { CoreCourseFormatModule } from './format/formats.module'; +import { CoreCourseFormatModule } from '@features/course/format/formats.module'; import { SITE_SCHEMA, OFFLINE_SITE_SCHEMA } from './services/database/course'; import { SITE_SCHEMA as LOG_SITE_SCHEMA } from './services/database/log'; import { SITE_SCHEMA as PREFETCH_SITE_SCHEMA } from './services/database/module-prefetch'; -import { CoreCourseIndexRoutingModule } from './pages/index/index-routing.module'; import { CoreCourseModulePrefetchDelegate, CoreCourseModulePrefetchDelegateService } from './services/module-prefetch-delegate'; import { CoreCronDelegate } from '@services/cron'; import { CoreCourseLogCronHandler } from './services/handlers/log-cron'; @@ -41,6 +38,7 @@ import { CoreCourseOfflineProvider } from './services/course-offline'; import { CoreCourseSyncProvider } from './services/sync'; import { COURSE_INDEX_PATH } from '@features/course/course-lazy.module'; import { buildRegExpUrlMatcher } from '@/app/app-routing.module'; +import { CoreCourseIndexRoutingModule } from '@features/course/course-routing.module'; export const CORE_COURSE_SERVICES: Type[] = [ CoreCourseProvider, @@ -68,7 +66,7 @@ const routes: Routes = [ const courseIndexRoutes: Routes = [ { path: CONTENTS_PAGE_NAME, - loadChildren: () => import('./pages/contents/contents.module').then(m => m.CoreCourseContentsPageModule), + loadChildren: () => import('@features/course/course-contents-lazy.module').then(m => m.CoreCourseContentsLazyModule), }, ]; @@ -77,8 +75,6 @@ const courseIndexRoutes: Routes = [ CoreCourseIndexRoutingModule.forChild({ children: courseIndexRoutes }), CoreMainMenuTabRoutingModule.forChild(routes), CoreCourseFormatModule, - CoreCourseComponentsModule, - CoreCourseDirectivesModule, ], exports: [CoreCourseIndexRoutingModule], providers: [ diff --git a/src/core/features/course/format/formats.module.ts b/src/core/features/course/format/formats.module.ts index 3519b6cb0..4b1177db1 100644 --- a/src/core/features/course/format/formats.module.ts +++ b/src/core/features/course/format/formats.module.ts @@ -27,4 +27,4 @@ import { CoreCourseFormatWeeksModule } from './weeks/weeks.module'; CoreCourseFormatWeeksModule, ], }) -export class CoreCourseFormatModule { } +export class CoreCourseFormatModule {} diff --git a/src/core/features/course/pages/course-summary/course-summary.module.ts b/src/core/features/course/pages/course-summary/course-summary.module.ts index c925524f7..c9c3f5fe9 100644 --- a/src/core/features/course/pages/course-summary/course-summary.module.ts +++ b/src/core/features/course/pages/course-summary/course-summary.module.ts @@ -12,19 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - import { CoreSharedModule } from '@/core/shared.module'; -import { CoreCourseSummaryPage } from './course-summary'; +import { NgModule } from '@angular/core'; +import { CoreCourseSummaryPage } from '@features/course/pages/course-summary/course-summary.page'; import { CoreRemindersComponentsModule } from '@features/reminders/components/components.module'; -const routes: Routes = [ - { - path: '', - component: CoreCourseSummaryPage, - }, -]; @NgModule({ imports: [ CoreSharedModule, @@ -34,15 +26,4 @@ const routes: Routes = [ CoreCourseSummaryPage, ], }) -export class CoreCoursePreviewPageComponentModule { } - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreCoursePreviewPageComponentModule, - CoreRemindersComponentsModule, - ], - exports: [RouterModule], -}) -export class CoreCourseSummaryPageModule { } +export class CoreCourseSummaryPageModule {} diff --git a/src/core/features/course/pages/course-summary/course-summary.ts b/src/core/features/course/pages/course-summary/course-summary.page.ts similarity index 100% rename from src/core/features/course/pages/course-summary/course-summary.ts rename to src/core/features/course/pages/course-summary/course-summary.page.ts diff --git a/src/core/features/course/pages/index/index.module.ts b/src/core/features/course/pages/index/index.module.ts deleted file mode 100644 index fafa96425..000000000 --- a/src/core/features/course/pages/index/index.module.ts +++ /dev/null @@ -1,53 +0,0 @@ -// (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. - -import { Injector, NgModule } from '@angular/core'; -import { RouterModule, ROUTES, Routes } from '@angular/router'; - -import { resolveModuleRoutes } from '@/app/app-routing.module'; -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreCourseIndexPage } from '.'; -import { COURSE_INDEX_ROUTES } from './index-routing.module'; -import { CoreCoursePreviewPageComponentModule } from '../course-summary/course-summary.module'; - -function buildRoutes(injector: Injector): Routes { - const routes = resolveModuleRoutes(injector, COURSE_INDEX_ROUTES); - - return [ - { - path: '', - component: CoreCourseIndexPage, - data: { - isCourseIndex: true, - }, - children: routes.children, - }, - ...routes.siblings, - ]; -} - -@NgModule({ - providers: [ - { provide: ROUTES, multi: true, useFactory: buildRoutes, deps: [Injector] }, - ], - imports: [ - CoreSharedModule, - CoreCoursePreviewPageComponentModule, - ], - declarations: [ - CoreCourseIndexPage, - ], - exports: [RouterModule], -}) -export class CoreCourseIndexPageModule {} diff --git a/src/core/features/course/pages/list-mod-type/list-mod-type.module.ts b/src/core/features/course/pages/list-mod-type/list-mod-type.module.ts deleted file mode 100644 index 4102b1136..000000000 --- a/src/core/features/course/pages/list-mod-type/list-mod-type.module.ts +++ /dev/null @@ -1,40 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreCourseListModTypePage } from './list-mod-type.page'; -import { CoreCourseComponentsModule } from '@features/course/components/components.module'; - -const routes: Routes = [ - { - path: '', - component: CoreCourseListModTypePage, - }, -]; - -@NgModule({ - declarations: [ - CoreCourseListModTypePage, - ], - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreCourseComponentsModule, - ], - exports: [RouterModule], -}) -export class CoreCourseListModTypePageModule {} diff --git a/src/core/features/course/pages/list-mod-type/list-mod-type.page.ts b/src/core/features/course/pages/list-mod-type/list-mod-type.ts similarity index 100% rename from src/core/features/course/pages/list-mod-type/list-mod-type.page.ts rename to src/core/features/course/pages/list-mod-type/list-mod-type.ts diff --git a/src/core/features/course/pages/module-preview/module-preview.module.ts b/src/core/features/course/pages/module-preview/module-preview.module.ts deleted file mode 100644 index ab346fcb0..000000000 --- a/src/core/features/course/pages/module-preview/module-preview.module.ts +++ /dev/null @@ -1,40 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreCourseModulePreviewPage } from './module-preview.page'; -import { CoreCourseComponentsModule } from '@features/course/components/components.module'; - -const routes: Routes = [ - { - path: '', - component: CoreCourseModulePreviewPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreCourseComponentsModule, - ], - declarations: [ - CoreCourseModulePreviewPage, - ], - exports: [RouterModule], -}) -export class CoreCourseModulePreviewPageModule { } diff --git a/src/core/features/course/pages/module-preview/module-preview.page.ts b/src/core/features/course/pages/module-preview/module-preview.ts similarity index 100% rename from src/core/features/course/pages/module-preview/module-preview.page.ts rename to src/core/features/course/pages/module-preview/module-preview.ts diff --git a/src/core/features/course/services/course-helper.ts b/src/core/features/course/services/course-helper.ts index 80bdcf75f..f9830defa 100644 --- a/src/core/features/course/services/course-helper.ts +++ b/src/core/features/course/services/course-helper.ts @@ -71,7 +71,7 @@ import { CoreNavigationOptions, CoreNavigator } from '@services/navigator'; import { CoreSiteHomeHomeHandlerService } from '@features/sitehome/services/handlers/sitehome-home'; import { CoreStatusWithWarningsWSResponse } from '@services/ws'; import { CoreCourseWithImageAndColor } from '@features/courses/services/courses-helper'; -import { CoreCourseSummaryPage } from '../pages/course-summary/course-summary'; +import { CoreCourseSummaryPage } from '../pages/course-summary/course-summary.page'; import { CoreRemindersPushNotificationData } from '@features/reminders/services/reminders'; import { CoreLocalNotifications } from '@services/local-notifications'; @@ -2043,7 +2043,7 @@ export class CoreCourseHelperProvider { * @returns Course summary page module. */ async getCourseSummaryRouteModule(): Promise { - return import('../pages/course-summary/course-summary.module').then(m => m.CoreCourseSummaryPageModule); + return import('../course-summary-lazy.module').then(m => m.CoreCourseSummaryLazyModule); } /** diff --git a/src/core/features/courses/pages/dashboard/dashboard.module.ts b/src/core/features/courses/courses-dashboard-lazy.module.ts similarity index 89% rename from src/core/features/courses/pages/dashboard/dashboard.module.ts rename to src/core/features/courses/courses-dashboard-lazy.module.ts index aafe02070..c43129073 100644 --- a/src/core/features/courses/pages/dashboard/dashboard.module.ts +++ b/src/core/features/courses/courses-dashboard-lazy.module.ts @@ -17,8 +17,7 @@ import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; import { CoreBlockComponentsModule } from '@features/block/components/components.module'; - -import { CoreCoursesDashboardPage } from './dashboard'; +import { CoreCoursesDashboardPage } from '@features/courses/pages/dashboard/dashboard'; const routes: Routes = [ { @@ -38,4 +37,4 @@ const routes: Routes = [ ], exports: [RouterModule], }) -export class CoreCoursesDashboardPageModule {} +export class CoreCoursesDashboardLazyModule {} diff --git a/src/core/features/courses/courses-lazy.module.ts b/src/core/features/courses/courses-lazy.module.ts index 38e98e5fc..178e63114 100644 --- a/src/core/features/courses/courses-lazy.module.ts +++ b/src/core/features/courses/courses-lazy.module.ts @@ -12,12 +12,24 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { CoreSharedModule } from '@/core/shared.module'; import { Injector, NgModule } from '@angular/core'; import { RouterModule, ROUTES, Routes } from '@angular/router'; +import { CoreCoursesComponentsModule } from '@features/courses/components/components.module'; +import { CoreCoursesCategoriesPage } from '@features/courses/pages/categories/categories'; +import { CoreCoursesListPage } from '@features/courses/pages/list/list'; +import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/components.module'; import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.module'; +import { CoreSearchComponentsModule } from '@features/search/components/components.module'; import { CoreCoursesHelper } from './services/courses-helper'; import { CoreCoursesMyCoursesMainMenuHandlerService } from './services/handlers/my-courses-mainmenu'; +/** + * Build module routes. + * + * @param injector Injector. + * @returns Routes. + */ function buildRoutes(injector: Injector): Routes { return [ { @@ -34,15 +46,11 @@ function buildRoutes(injector: Injector): Routes { }, { path: 'categories/:id', - loadChildren: () => - import('./pages/categories/categories.module') - .then(m => m.CoreCoursesCategoriesPageModule), + component: CoreCoursesCategoriesPage, }, { path: 'list', - loadChildren: () => - import('./pages/list/list.module') - .then(m => m.CoreCoursesListPageModule), + component: CoreCoursesListPage, }, ...buildTabMainRoutes(injector, { redirectTo: 'my', @@ -52,6 +60,16 @@ function buildRoutes(injector: Injector): Routes { } @NgModule({ + imports: [ + CoreSharedModule, + CoreCoursesComponentsModule, + CoreMainMenuComponentsModule, + CoreSearchComponentsModule, + ], + declarations: [ + CoreCoursesCategoriesPage, + CoreCoursesListPage, + ], exports: [RouterModule], providers: [ { diff --git a/src/core/features/courses/pages/my/my.module.ts b/src/core/features/courses/courses-my-lazy.module.ts similarity index 87% rename from src/core/features/courses/pages/my/my.module.ts rename to src/core/features/courses/courses-my-lazy.module.ts index 96b405151..5af380251 100644 --- a/src/core/features/courses/pages/my/my.module.ts +++ b/src/core/features/courses/courses-my-lazy.module.ts @@ -18,13 +18,13 @@ import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; import { CoreBlockComponentsModule } from '@features/block/components/components.module'; -import { CoreCoursesMyCoursesPage } from './my'; import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/components.module'; +import { CoreCoursesMyPage } from '@features/courses/pages/my/my'; const routes: Routes = [ { path: '', - component: CoreCoursesMyCoursesPage, + component: CoreCoursesMyPage, }, ]; @@ -36,8 +36,8 @@ const routes: Routes = [ CoreMainMenuComponentsModule, ], declarations: [ - CoreCoursesMyCoursesPage, + CoreCoursesMyPage, ], exports: [RouterModule], }) -export class CoreCoursesMyCoursesPageModule { } +export class CoreCoursesMyLazyModule {} diff --git a/src/core/features/courses/courses.module.ts b/src/core/features/courses/courses.module.ts index c4bd4bf93..51503f2db 100644 --- a/src/core/features/courses/courses.module.ts +++ b/src/core/features/courses/courses.module.ts @@ -19,7 +19,7 @@ import { CoreCourseHelper } from '@features/course/services/course-helper'; import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; -import { CoreMainMenuHomeRoutingModule } from '@features/mainmenu/pages/home/home-routing.module'; +import { CoreMainMenuHomeRoutingModule } from '@features/mainmenu/mainmenu-home-routing.module'; import { CoreMainMenuHomeDelegate } from '@features/mainmenu/services/home-delegate'; import { CoreMainMenuDelegate } from '@features/mainmenu/services/mainmenu-delegate'; import { CorePushNotificationsDelegate } from '@features/pushnotifications/services/push-delegate'; @@ -50,7 +50,7 @@ export const CORE_COURSES_SERVICES: Type[] = [ const mainMenuHomeChildrenRoutes: Routes = [ { path: CoreDashboardHomeHandlerService.PAGE_NAME, - loadChildren: () => import('./pages/dashboard/dashboard.module').then(m => m.CoreCoursesDashboardPageModule), + loadChildren: () => import('./courses-dashboard-lazy.module').then(m => m.CoreCoursesDashboardLazyModule), }, ]; diff --git a/src/core/features/courses/pages/categories/categories.module.ts b/src/core/features/courses/pages/categories/categories.module.ts deleted file mode 100644 index b49b429b1..000000000 --- a/src/core/features/courses/pages/categories/categories.module.ts +++ /dev/null @@ -1,41 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreCoursesComponentsModule } from '../../components/components.module'; - -import { CoreCoursesCategoriesPage } from './categories'; - -const routes: Routes = [ - { - path: '', - component: CoreCoursesCategoriesPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreCoursesComponentsModule, - ], - declarations: [ - CoreCoursesCategoriesPage, - ], - exports: [RouterModule], -}) -export class CoreCoursesCategoriesPageModule { } diff --git a/src/core/features/courses/pages/list/list.module.ts b/src/core/features/courses/pages/list/list.module.ts deleted file mode 100644 index 23dd52438..000000000 --- a/src/core/features/courses/pages/list/list.module.ts +++ /dev/null @@ -1,45 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreCoursesComponentsModule } from '../../components/components.module'; -import { CoreSearchComponentsModule } from '@features/search/components/components.module'; - -import { CoreCoursesListPage } from './list'; -import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/components.module'; - -const routes: Routes = [ - { - path: '', - component: CoreCoursesListPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreCoursesComponentsModule, - CoreSearchComponentsModule, - CoreMainMenuComponentsModule, - ], - declarations: [ - CoreCoursesListPage, - ], - exports: [RouterModule], -}) -export class CoreCoursesListPageModule { } diff --git a/src/core/features/courses/pages/my/my.ts b/src/core/features/courses/pages/my/my.ts index 3a8e8c2b8..99c212873 100644 --- a/src/core/features/courses/pages/my/my.ts +++ b/src/core/features/courses/pages/my/my.ts @@ -42,7 +42,7 @@ import { CoreCourses } from '../../services/courses'; useClass: PageLoadsManager, }], }) -export class CoreCoursesMyCoursesPage implements OnInit, OnDestroy, AsyncDirective { +export class CoreCoursesMyPage implements OnInit, OnDestroy, AsyncDirective { @ViewChild(CoreBlockComponent) block!: CoreBlockComponent; diff --git a/src/core/features/courses/services/courses-helper.ts b/src/core/features/courses/services/courses-helper.ts index 6b1a75add..74a7b5640 100644 --- a/src/core/features/courses/services/courses-helper.ts +++ b/src/core/features/courses/services/courses-helper.ts @@ -415,7 +415,7 @@ export class CoreCoursesHelperProvider { * @returns My courses page module. */ async getMyRouteModule(): Promise { - return import('../pages/my/my.module').then(m => m.CoreCoursesMyCoursesPageModule); + return import('../courses-my-lazy.module').then(m => m.CoreCoursesMyLazyModule); } } diff --git a/src/core/features/filter/filter.module.ts b/src/core/features/filter/filter.module.ts index 771565277..ff4e475ef 100644 --- a/src/core/features/filter/filter.module.ts +++ b/src/core/features/filter/filter.module.ts @@ -24,4 +24,4 @@ export const CORE_FILTER_SERVICES: Type[] = [ ]; @NgModule({}) -export class CoreFilterModule { } +export class CoreFilterModule {} diff --git a/src/core/features/grades/grades-courses-lazy.module.ts b/src/core/features/grades/grades-courses-lazy.module.ts index 8dbc73cf5..785cd4897 100644 --- a/src/core/features/grades/grades-courses-lazy.module.ts +++ b/src/core/features/grades/grades-courses-lazy.module.ts @@ -21,7 +21,7 @@ import { CoreSharedModule } from '@/core/shared.module'; import { CoreGradesCoursePage } from './pages/course/course.page'; import { CoreGradesCoursePageModule } from './pages/course/course.module'; -import { CoreGradesCoursesPage } from './pages/courses/courses.page'; +import { CoreGradesCoursesPage } from './pages/courses/courses'; const mobileRoutes: Routes = [ { diff --git a/src/core/features/grades/grades.module.ts b/src/core/features/grades/grades.module.ts index 9b6ae6251..24796d3de 100644 --- a/src/core/features/grades/grades.module.ts +++ b/src/core/features/grades/grades.module.ts @@ -16,7 +16,7 @@ import { APP_INITIALIZER, NgModule, Type } from '@angular/core'; import { Routes } from '@angular/router'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; import { COURSE_PAGE_NAME } from '@features/course/course.module'; -import { CoreCourseIndexRoutingModule } from '@features/course/pages/index/index-routing.module'; +import { CoreCourseIndexRoutingModule } from '@features/course/course-routing.module'; import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreUserDelegate } from '@features/user/services/user-delegate'; diff --git a/src/core/features/grades/pages/courses/courses.page.ts b/src/core/features/grades/pages/courses/courses.ts similarity index 100% rename from src/core/features/grades/pages/courses/courses.page.ts rename to src/core/features/grades/pages/courses/courses.ts diff --git a/src/core/features/login/pages/credentials/credentials.module.ts b/src/core/features/login/login-credentials-lazy.module.ts similarity index 89% rename from src/core/features/login/pages/credentials/credentials.module.ts rename to src/core/features/login/login-credentials-lazy.module.ts index f8fcfc0a0..3c5d14e09 100644 --- a/src/core/features/login/pages/credentials/credentials.module.ts +++ b/src/core/features/login/login-credentials-lazy.module.ts @@ -17,7 +17,7 @@ import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; import { CoreLoginComponentsModule } from '@features/login/components/components.module'; -import { CoreLoginCredentialsPage } from './credentials'; +import { CoreLoginCredentialsPage } from '@features/login/pages/credentials/credentials'; const routes: Routes = [ { @@ -37,4 +37,4 @@ const routes: Routes = [ ], exports: [RouterModule], }) -export class CoreLoginCredentialsPageModule {} +export class CoreLoginCredentialsLazyModule {} diff --git a/src/core/features/login/login-lazy.module.ts b/src/core/features/login/login-lazy.module.ts index adef10700..4e209d264 100644 --- a/src/core/features/login/login-lazy.module.ts +++ b/src/core/features/login/login-lazy.module.ts @@ -20,6 +20,12 @@ import { CoreLoginHasSitesGuard } from './guards/has-sites'; import { CoreLoginComponentsModule } from './components/components.module'; import { CoreLoginHelper } from './services/login-helper'; import { CoreLoginForgottenPasswordPage } from '@features/login/pages/forgotten-password/forgotten-password'; +import { CoreLoginSitePolicyPage } from '@features/login/pages/site-policy/site-policy'; +import { CoreUserComponentsModule } from '@features/user/components/components.module'; +import { CoreLoginEmailSignupPage } from '@features/login/pages/email-signup/email-signup'; +import { CoreLoginSitePage } from '@features/login/pages/site/site'; +import { CoreLoginSitesPage } from '@features/login/pages/sites/sites'; +import { CoreLoginChangePasswordPage } from '@features/login/pages/change-password/change-password'; const routes: Routes = [ { @@ -29,7 +35,7 @@ const routes: Routes = [ }, { path: 'site', - loadChildren: () => import('./pages/site/site.module').then( m => m.CoreLoginSitePageModule), + component: CoreLoginSitePage, }, { path: 'credentials', @@ -37,7 +43,7 @@ const routes: Routes = [ }, { path: 'sites', - loadChildren: () => import('./pages/sites/sites.module').then( m => m.CoreLoginSitesPageModule), + component: CoreLoginSitesPage, canLoad: [CoreLoginHasSitesGuard], canActivate: [CoreLoginHasSitesGuard], }, @@ -47,16 +53,15 @@ const routes: Routes = [ }, { path: 'changepassword', - loadChildren: () => import('./pages/change-password/change-password.module') - .then( m => m.CoreLoginChangePasswordPageModule), + component: CoreLoginChangePasswordPage, }, { path: 'sitepolicy', - loadChildren: () => import('./pages/site-policy/site-policy.module').then( m => m.CoreLoginSitePolicyPageModule), + component: CoreLoginSitePolicyPage, }, { path: 'emailsignup', - loadChildren: () => import('./pages/email-signup/email-signup.module').then( m => m.CoreLoginEmailSignupPageModule), + component: CoreLoginEmailSignupPage, }, { path: 'reconnect', @@ -68,10 +73,16 @@ const routes: Routes = [ imports: [ CoreSharedModule, CoreLoginComponentsModule, + CoreUserComponentsModule, RouterModule.forChild(routes), ], declarations: [ CoreLoginForgottenPasswordPage, + CoreLoginSitePolicyPage, + CoreLoginSitePage, + CoreLoginSitesPage, + CoreLoginChangePasswordPage, + CoreLoginEmailSignupPage, ], }) export class CoreLoginLazyModule {} diff --git a/src/core/features/login/pages/reconnect/reconnect.module.ts b/src/core/features/login/login-reconnect-lazy.module.ts similarity index 90% rename from src/core/features/login/pages/reconnect/reconnect.module.ts rename to src/core/features/login/login-reconnect-lazy.module.ts index 597d8f68b..dafd7e819 100644 --- a/src/core/features/login/pages/reconnect/reconnect.module.ts +++ b/src/core/features/login/login-reconnect-lazy.module.ts @@ -16,8 +16,8 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; -import { CoreLoginReconnectPage } from './reconnect'; import { CoreLoginComponentsModule } from '@features/login/components/components.module'; +import { CoreLoginReconnectPage } from '@features/login/pages/reconnect/reconnect'; const routes: Routes = [ { @@ -37,4 +37,4 @@ const routes: Routes = [ ], exports: [RouterModule], }) -export class CoreLoginReconnectPageModule {} +export class CoreLoginReconnectLazyModule {} diff --git a/src/core/features/login/pages/change-password/change-password.module.ts b/src/core/features/login/pages/change-password/change-password.module.ts deleted file mode 100644 index d10ce6e20..000000000 --- a/src/core/features/login/pages/change-password/change-password.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreLoginChangePasswordPage } from './change-password'; - -const routes: Routes = [ - { - path: '', - component: CoreLoginChangePasswordPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - CoreLoginChangePasswordPage, - ], - exports: [RouterModule], -}) -export class CoreLoginChangePasswordPageModule {} diff --git a/src/core/features/login/pages/email-signup/email-signup.module.ts b/src/core/features/login/pages/email-signup/email-signup.module.ts deleted file mode 100644 index 886991e3d..000000000 --- a/src/core/features/login/pages/email-signup/email-signup.module.ts +++ /dev/null @@ -1,41 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreUserComponentsModule } from '@features/user/components/components.module'; - -import { CoreLoginEmailSignupPage } from './email-signup'; - -const routes: Routes = [ - { - path: '', - component: CoreLoginEmailSignupPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreUserComponentsModule, - ], - declarations: [ - CoreLoginEmailSignupPage, - ], - exports: [RouterModule], -}) -export class CoreLoginEmailSignupPageModule {} diff --git a/src/core/features/login/pages/site-policy/site-policy.module.ts b/src/core/features/login/pages/site-policy/site-policy.module.ts deleted file mode 100644 index d0e6d7440..000000000 --- a/src/core/features/login/pages/site-policy/site-policy.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreLoginSitePolicyPage } from './site-policy'; - -const routes: Routes = [ - { - path: '', - component: CoreLoginSitePolicyPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - CoreLoginSitePolicyPage, - ], - exports: [RouterModule], -}) -export class CoreLoginSitePolicyPageModule {} diff --git a/src/core/features/login/pages/site/site.module.ts b/src/core/features/login/pages/site/site.module.ts deleted file mode 100644 index ea16add88..000000000 --- a/src/core/features/login/pages/site/site.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreLoginSitePage } from './site'; - -const routes: Routes = [ - { - path: '', - component: CoreLoginSitePage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - CoreLoginSitePage, - ], - exports: [RouterModule], -}) -export class CoreLoginSitePageModule {} diff --git a/src/core/features/login/pages/sites/sites.module.ts b/src/core/features/login/pages/sites/sites.module.ts deleted file mode 100644 index 587010ee7..000000000 --- a/src/core/features/login/pages/sites/sites.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreLoginSitesPage } from './sites'; - -const routes: Routes = [ - { - path: '', - component: CoreLoginSitesPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - CoreLoginSitesPage, - ], - exports: [RouterModule], -}) -export class CoreLoginSitesPageModule {} diff --git a/src/core/features/login/services/login-helper.ts b/src/core/features/login/services/login-helper.ts index d860cddc7..1dd19f48b 100644 --- a/src/core/features/login/services/login-helper.ts +++ b/src/core/features/login/services/login-helper.ts @@ -1469,7 +1469,7 @@ export class CoreLoginHelperProvider { * @returns Reconnect page route module. */ async getReconnectRouteModule(): Promise { - return import('@features/login/pages/reconnect/reconnect.module').then(m => m.CoreLoginReconnectPageModule); + return import('@features/login/login-reconnect-lazy.module').then(m => m.CoreLoginReconnectLazyModule); } /** @@ -1478,7 +1478,7 @@ export class CoreLoginHelperProvider { * @returns Credentials page route module. */ async getCredentialsRouteModule(): Promise { - return import('@features/login/pages/credentials/credentials.module').then(m => m.CoreLoginCredentialsPageModule); + return import('@features/login/login-credentials-lazy.module').then(m => m.CoreLoginCredentialsLazyModule); } /** diff --git a/src/core/features/mainmenu/pages/home/home.module.ts b/src/core/features/mainmenu/mainmenu-home-lazy.module.ts similarity index 83% rename from src/core/features/mainmenu/pages/home/home.module.ts rename to src/core/features/mainmenu/mainmenu-home-lazy.module.ts index 7dcde146c..c84e2b91a 100644 --- a/src/core/features/mainmenu/pages/home/home.module.ts +++ b/src/core/features/mainmenu/mainmenu-home-lazy.module.ts @@ -15,17 +15,22 @@ import { Injector, NgModule } from '@angular/core'; import { RouterModule, ROUTES, Routes } from '@angular/router'; -import { resolveModuleRoutes } from '@/app/app-routing.module'; import { CoreSharedModule } from '@/core/shared.module'; -import { CoreMainMenuHomePage } from './home'; -import { MAIN_MENU_HOME_ROUTES } from './home-routing.module'; import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreMainMenuHomeHandlerService } from '@features/mainmenu/services/handlers/mainmenu'; import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/components.module'; +import { resolveHomeRoutes } from '@features/mainmenu/mainmenu-home-routing.module'; +import { CoreMainMenuHomePage } from '@features/mainmenu/pages/home/home'; +/** + * Build module routes. + * + * @param injector Injector. + * @returns Routes. + */ function buildRoutes(injector: Injector): Routes { - const routes = resolveModuleRoutes(injector, MAIN_MENU_HOME_ROUTES); + const routes = resolveHomeRoutes(injector); return [ ...buildTabMainRoutes(injector, { @@ -55,4 +60,4 @@ function buildRoutes(injector: Injector): Routes { RouterModule, ], }) -export class CoreMainMenuHomePageModule {} +export class CoreMainMenuHomeLazyModule {} diff --git a/src/core/features/mainmenu/pages/home/home-routing.module.ts b/src/core/features/mainmenu/mainmenu-home-routing.module.ts similarity index 66% rename from src/core/features/mainmenu/pages/home/home-routing.module.ts rename to src/core/features/mainmenu/mainmenu-home-routing.module.ts index ab6a7634c..f3d546713 100644 --- a/src/core/features/mainmenu/pages/home/home-routing.module.ts +++ b/src/core/features/mainmenu/mainmenu-home-routing.module.ts @@ -12,11 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { InjectionToken, ModuleWithProviders, NgModule } from '@angular/core'; +import { InjectionToken, Injector, ModuleWithProviders, NgModule } from '@angular/core'; -import { ModuleRoutesConfig } from '@/app/app-routing.module'; +import { ModuleRoutes, ModuleRoutesConfig, resolveModuleRoutes } from '@/app/app-routing.module'; -export const MAIN_MENU_HOME_ROUTES = new InjectionToken('MAIN_MENU_HOME_ROUTES'); +const MAIN_MENU_HOME_ROUTES = new InjectionToken('MAIN_MENU_HOME_ROUTES'); + +/** + * Resolve dynamic routes. + * + * @param injector Injector. + * @returns Module routes. + */ +export function resolveHomeRoutes(injector: Injector): ModuleRoutes { + return resolveModuleRoutes(injector, MAIN_MENU_HOME_ROUTES); +} @NgModule() export class CoreMainMenuHomeRoutingModule { diff --git a/src/core/features/mainmenu/mainmenu-lazy.module.ts b/src/core/features/mainmenu/mainmenu-lazy.module.ts index 579510de6..8e4290ba0 100644 --- a/src/core/features/mainmenu/mainmenu-lazy.module.ts +++ b/src/core/features/mainmenu/mainmenu-lazy.module.ts @@ -16,16 +16,20 @@ import { Injector, NgModule } from '@angular/core'; import { ROUTES, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; -import { resolveModuleRoutes } from '@/app/app-routing.module'; - -import { MAIN_MENU_ROUTES } from './mainmenu-routing.module'; +import { resolveMainMenuRoutes } from './mainmenu-routing.module'; import { CoreMainMenuPage } from './pages/menu/menu'; import { CoreMainMenuHomeHandlerService } from './services/handlers/mainmenu'; import { CoreMainMenuProvider } from './services/mainmenu'; import { CoreMainMenuComponentsModule } from './components/components.module'; +/** + * Build module routes. + * + * @param injector Injector. + * @returns Routes. + */ function buildRoutes(injector: Injector): Routes { - const routes = resolveModuleRoutes(injector, MAIN_MENU_ROUTES); + const mainMenuRoutes = resolveMainMenuRoutes(injector); return [ { @@ -38,16 +42,16 @@ function buildRoutes(injector: Injector): Routes { }, { path: CoreMainMenuHomeHandlerService.PAGE_NAME, - loadChildren: () => import('./pages/home/home.module').then(m => m.CoreMainMenuHomePageModule), + loadChildren: () => import('./mainmenu-home-lazy.module').then(m => m.CoreMainMenuHomeLazyModule), }, { path: CoreMainMenuProvider.MORE_PAGE_NAME, - loadChildren: () => import('./pages/more/more.module').then(m => m.CoreMainMenuMorePageModule), + loadChildren: () => import('./mainmenu-more-lazy.module').then(m => m.CoreMainMenuMoreLazyModule), }, - ...routes.children, + ...mainMenuRoutes.children, ], }, - ...routes.siblings, + ...mainMenuRoutes.siblings, ]; } diff --git a/src/core/features/mainmenu/pages/more/more.module.ts b/src/core/features/mainmenu/mainmenu-more-lazy.module.ts similarity index 70% rename from src/core/features/mainmenu/pages/more/more.module.ts rename to src/core/features/mainmenu/mainmenu-more-lazy.module.ts index 770fa3d9b..e7d53aafc 100644 --- a/src/core/features/mainmenu/pages/more/more.module.ts +++ b/src/core/features/mainmenu/mainmenu-more-lazy.module.ts @@ -13,13 +13,28 @@ // limitations under the License. import { Injector, NgModule } from '@angular/core'; -import { RouterModule, ROUTES } from '@angular/router'; +import { RouterModule, Routes, ROUTES } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; -import { CoreMainMenuMorePage } from './more'; import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreMainMenuProvider } from '@features/mainmenu/services/mainmenu'; import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/components.module'; +import { CoreMainMenuMorePage } from '@features/mainmenu/pages/more/more'; + +/** + * Build module routes. + * + * @param injector Injector. + * @returns Routes. + */ +function buildRoutes(injector: Injector): Routes { + return buildTabMainRoutes(injector, { + component: CoreMainMenuMorePage, + data: { + mainMenuTabRoot: CoreMainMenuProvider.MORE_PAGE_NAME, + }, + }); +} @NgModule({ imports: [ @@ -31,12 +46,7 @@ import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/comp provide: ROUTES, multi: true, deps: [Injector], - useFactory: (injector: Injector) => buildTabMainRoutes(injector, { - component: CoreMainMenuMorePage, - data: { - mainMenuTabRoot: CoreMainMenuProvider.MORE_PAGE_NAME, - }, - }), + useFactory: buildRoutes, }, ], declarations: [ @@ -46,4 +56,4 @@ import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/comp RouterModule, ], }) -export class CoreMainMenuMorePageModule {} +export class CoreMainMenuMoreLazyModule {} diff --git a/src/core/features/mainmenu/pages/reload/reload.module.ts b/src/core/features/mainmenu/mainmenu-reload-lazy.module.ts similarity index 89% rename from src/core/features/mainmenu/pages/reload/reload.module.ts rename to src/core/features/mainmenu/mainmenu-reload-lazy.module.ts index 74a1fb7aa..d9fab0633 100644 --- a/src/core/features/mainmenu/pages/reload/reload.module.ts +++ b/src/core/features/mainmenu/mainmenu-reload-lazy.module.ts @@ -15,7 +15,7 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; -import { CoreMainMenuReloadPage } from './reload'; +import { CoreMainMenuReloadPage } from '@features/mainmenu/pages/reload/reload'; const routes: Routes = [ { @@ -34,4 +34,4 @@ const routes: Routes = [ ], exports: [RouterModule], }) -export class CoreMainMenuReloadPageModule {} +export class CoreMainMenuReloadLazyModule {} diff --git a/src/core/features/mainmenu/mainmenu-routing.module.ts b/src/core/features/mainmenu/mainmenu-routing.module.ts index 5b9e25589..84fb3c7c5 100644 --- a/src/core/features/mainmenu/mainmenu-routing.module.ts +++ b/src/core/features/mainmenu/mainmenu-routing.module.ts @@ -12,11 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { InjectionToken, ModuleWithProviders, NgModule } from '@angular/core'; +import { InjectionToken, Injector, ModuleWithProviders, NgModule } from '@angular/core'; -import { ModuleRoutesConfig } from '@/app/app-routing.module'; +import { ModuleRoutes, ModuleRoutesConfig, resolveModuleRoutes } from '@/app/app-routing.module'; -export const MAIN_MENU_ROUTES = new InjectionToken('MAIN_MENU_ROUTES'); +const MAIN_MENU_ROUTES = new InjectionToken('MAIN_MENU_ROUTES'); + +/** + * Resolve dynamic routes. + * + * @param injector Injector. + * @returns Module routes. + */ +export function resolveMainMenuRoutes(injector: Injector): ModuleRoutes { + return resolveModuleRoutes(injector, MAIN_MENU_ROUTES); +} @NgModule() export class CoreMainMenuRoutingModule { diff --git a/src/core/features/mainmenu/mainmenu-tab-routing.module.ts b/src/core/features/mainmenu/mainmenu-tab-routing.module.ts index 9c5be32ce..1e58919a7 100644 --- a/src/core/features/mainmenu/mainmenu-tab-routing.module.ts +++ b/src/core/features/mainmenu/mainmenu-tab-routing.module.ts @@ -17,8 +17,14 @@ import { Route, Routes } from '@angular/router'; import { ModuleRoutesConfig, resolveModuleRoutes } from '@/app/app-routing.module'; -export const MAIN_MENU_TAB_ROUTES = new InjectionToken('MAIN_MENU_TAB_ROUTES'); +const MAIN_MENU_TAB_ROUTES = new InjectionToken('MAIN_MENU_TAB_ROUTES'); +/** + * Build module routes. + * + * @param injector Injector. + * @returns Routes. + */ export function buildTabMainRoutes(injector: Injector, mainRoute: Route): Routes { const routes = resolveModuleRoutes(injector, MAIN_MENU_TAB_ROUTES); diff --git a/src/core/features/mainmenu/mainmenu.module.ts b/src/core/features/mainmenu/mainmenu.module.ts index 3ff9bf494..361a01b69 100644 --- a/src/core/features/mainmenu/mainmenu.module.ts +++ b/src/core/features/mainmenu/mainmenu.module.ts @@ -43,7 +43,7 @@ const appRoutes: Routes = [ }, { path: 'reload', - loadChildren: () => import('./pages/reload/reload.module').then( m => m.CoreMainMenuReloadPageModule), + loadChildren: () => import('./mainmenu-reload-lazy.module').then( m => m.CoreMainMenuReloadLazyModule), }, ]; diff --git a/src/core/features/settings/pages/about/about.module.ts b/src/core/features/settings/pages/about/about.module.ts deleted file mode 100644 index 8debf902f..000000000 --- a/src/core/features/settings/pages/about/about.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreSettingsAboutPage } from './about'; - -const routes: Routes = [ - { - path: '', - component: CoreSettingsAboutPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - CoreSettingsAboutPage, - ], - exports: [RouterModule], -}) -export class CoreSettingsAboutPageModule {} diff --git a/src/core/features/settings/pages/deviceinfo/deviceinfo.module.ts b/src/core/features/settings/pages/deviceinfo/deviceinfo.module.ts deleted file mode 100644 index 2bc510b76..000000000 --- a/src/core/features/settings/pages/deviceinfo/deviceinfo.module.ts +++ /dev/null @@ -1,44 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreSettingsDeviceInfoPage } from './deviceinfo'; -import { CoreSettingsDevPage } from '../dev/dev'; - -const routes: Routes = [ - { - path: '', - component: CoreSettingsDeviceInfoPage, - }, - { - path: 'dev', - component: CoreSettingsDevPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - CoreSettingsDeviceInfoPage, - CoreSettingsDevPage, - ], - exports: [RouterModule], -}) -export class CoreSettingsDeviceInfoPageModule {} diff --git a/src/core/features/settings/pages/general/general.module.ts b/src/core/features/settings/pages/general/general.module.ts deleted file mode 100644 index cc5f52c17..000000000 --- a/src/core/features/settings/pages/general/general.module.ts +++ /dev/null @@ -1,39 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreSettingsGeneralPage } from './general'; - -const routes: Routes = [ - { - path: '', - component: CoreSettingsGeneralPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - CoreSettingsGeneralPage, - ], - exports: [RouterModule], - -}) -export class CoreSettingsGeneralPageModule {} diff --git a/src/core/features/settings/pages/licenses/licenses.module.ts b/src/core/features/settings/pages/licenses/licenses.module.ts deleted file mode 100644 index 441262afe..000000000 --- a/src/core/features/settings/pages/licenses/licenses.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreSettingsLicensesPage } from './licenses'; - -const routes: Routes = [ - { - path: '', - component: CoreSettingsLicensesPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - CoreSettingsLicensesPage, - ], - exports: [RouterModule], -}) -export class CoreSettingsLicensesPageModule {} diff --git a/src/core/features/settings/pages/space-usage/space-usage.module.ts b/src/core/features/settings/pages/space-usage/space-usage.module.ts deleted file mode 100644 index 1f5dead54..000000000 --- a/src/core/features/settings/pages/space-usage/space-usage.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreSettingsSpaceUsagePage } from './space-usage'; - -const routes: Routes = [ - { - path: '', - component: CoreSettingsSpaceUsagePage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - CoreSettingsSpaceUsagePage, - ], - exports: [RouterModule], -}) -export class CoreSettingsSpaceUsagePageModule {} diff --git a/src/core/features/settings/pages/synchronization/synchronization.module.ts b/src/core/features/settings/pages/synchronization/synchronization.module.ts deleted file mode 100644 index aeac4fea4..000000000 --- a/src/core/features/settings/pages/synchronization/synchronization.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreSettingsSynchronizationPage } from './synchronization'; - -const routes: Routes = [ - { - path: '', - component: CoreSettingsSynchronizationPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - CoreSettingsSynchronizationPage, - ], - exports: [RouterModule], -}) -export class CoreSettingsSynchronizationPageModule {} diff --git a/src/core/features/settings/settings-lazy.module.ts b/src/core/features/settings/settings-lazy.module.ts index e58ddf245..c5745ead9 100644 --- a/src/core/features/settings/settings-lazy.module.ts +++ b/src/core/features/settings/settings-lazy.module.ts @@ -21,21 +21,26 @@ import { CoreScreen } from '@services/screen'; import { CoreSettingsIndexPage } from './pages/index'; import { SHAREDFILES_PAGE_NAME } from '@features/sharedfiles/sharedfiles.module'; +import { CoreSettingsSynchronizationPage } from '@features/settings/pages/synchronization/synchronization'; +import { CoreSettingsGeneralPage } from '@features/settings/pages/general/general'; +import { CoreSettingsSpaceUsagePage } from '@features/settings/pages/space-usage/space-usage'; +import { CoreSettingsAboutPage } from '@features/settings/pages/about/about'; +import { CoreSettingsLicensesPage } from '@features/settings/pages/licenses/licenses'; +import { CoreSettingsDeviceInfoPage } from '@features/settings/pages/deviceinfo/deviceinfo'; +import { CoreSettingsDevPage } from '@features/settings/pages/dev/dev'; const sectionRoutes: Routes = [ { path: 'general', - loadChildren: () => import('./pages/general/general.module').then(m => m.CoreSettingsGeneralPageModule), + component: CoreSettingsGeneralPage, }, { path: 'spaceusage', - loadChildren: () => import('./pages/space-usage/space-usage.module').then(m => m.CoreSettingsSpaceUsagePageModule), + component: CoreSettingsSpaceUsagePage, }, { path: 'sync', - loadChildren: () => - import('./pages/synchronization/synchronization.module') - .then(m => m.CoreSettingsSynchronizationPageModule), + component: CoreSettingsSynchronizationPage, }, { path: SHAREDFILES_PAGE_NAME, @@ -43,7 +48,7 @@ const sectionRoutes: Routes = [ }, { path: 'about', - loadChildren: () => import('./pages/about/about.module').then(m => m.CoreSettingsAboutPageModule), + component: CoreSettingsAboutPage, }, ]; @@ -75,11 +80,15 @@ const routes: Routes = [ ...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet), { path: 'about/deviceinfo', - loadChildren: () => import('./pages/deviceinfo/deviceinfo.module').then(m => m.CoreSettingsDeviceInfoPageModule), + component: CoreSettingsDeviceInfoPage, + }, + { + path: 'about/deviceinfo/dev', + component: CoreSettingsDevPage, }, { path: 'about/licenses', - loadChildren: () => import('./pages/licenses/licenses.module').then(m => m.CoreSettingsLicensesPageModule), + component: CoreSettingsLicensesPage, }, ]; @@ -90,6 +99,13 @@ const routes: Routes = [ ], declarations: [ CoreSettingsIndexPage, + CoreSettingsSynchronizationPage, + CoreSettingsGeneralPage, + CoreSettingsSpaceUsagePage, + CoreSettingsAboutPage, + CoreSettingsLicensesPage, + CoreSettingsDeviceInfoPage, + CoreSettingsDevPage, ], }) export class CoreSettingsLazyModule {} diff --git a/src/core/features/settings/pages/site/site.module.ts b/src/core/features/settings/settings-site-lazy.module.ts similarity index 80% rename from src/core/features/settings/pages/site/site.module.ts rename to src/core/features/settings/settings-site-lazy.module.ts index a160cc2fb..29bd49fec 100644 --- a/src/core/features/settings/pages/site/site.module.ts +++ b/src/core/features/settings/settings-site-lazy.module.ts @@ -16,23 +16,26 @@ import { Injector, NgModule } from '@angular/core'; import { RouterModule, ROUTES, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; -import { CoreSitePreferencesPage } from './site'; -import { conditionalRoutes, resolveModuleRoutes } from '@/app/app-routing.module'; -import { SITE_PREFERENCES_ROUTES } from './site-routing'; +import { conditionalRoutes } from '@/app/app-routing.module'; import { CoreScreen } from '@services/screen'; +import { CoreSitePreferencesPage } from '@features/settings/pages/site/site'; +import { resolveSiteRoutes } from '@features/settings/settings-site-routing.module'; +/** + * Build module routes. + * + * @param injector Injector. + * @returns Routes. + */ function buildRoutes(injector: Injector): Routes { - const routes = resolveModuleRoutes(injector, SITE_PREFERENCES_ROUTES); - + const routes = resolveSiteRoutes(injector); const mobileRoutes: Routes = [ { path: '', component: CoreSitePreferencesPage, }, ...routes.siblings, - ]; - const tabletRoutes: Routes = [ { path: '', @@ -59,4 +62,4 @@ function buildRoutes(injector: Injector): Routes { ], exports: [RouterModule], }) -export class CoreSitePreferencesPageModule {} +export class CoreettingsSiteLazyModule {} diff --git a/src/core/features/settings/pages/site/site-routing.ts b/src/core/features/settings/settings-site-routing.module.ts similarity index 66% rename from src/core/features/settings/pages/site/site-routing.ts rename to src/core/features/settings/settings-site-routing.module.ts index 367a3b92f..a19a7a4bd 100644 --- a/src/core/features/settings/pages/site/site-routing.ts +++ b/src/core/features/settings/settings-site-routing.module.ts @@ -12,11 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { InjectionToken, ModuleWithProviders, NgModule } from '@angular/core'; +import { InjectionToken, Injector, ModuleWithProviders, NgModule } from '@angular/core'; -import { ModuleRoutesConfig } from '@/app/app-routing.module'; +import { ModuleRoutes, ModuleRoutesConfig, resolveModuleRoutes } from '@/app/app-routing.module'; -export const SITE_PREFERENCES_ROUTES = new InjectionToken('SITE_PREFERENCES_ROUTES'); +const SITE_PREFERENCES_ROUTES = new InjectionToken('SITE_PREFERENCES_ROUTES'); + +/** + * Resolve dynamic routes. + * + * @param injector Injector. + * @returns Module routes. + */ +export function resolveSiteRoutes(injector: Injector): ModuleRoutes { + return resolveModuleRoutes(injector, SITE_PREFERENCES_ROUTES); +} @NgModule() export class CoreSitePreferencesRoutingModule { diff --git a/src/core/features/settings/settings.module.ts b/src/core/features/settings/settings.module.ts index e94d2072b..8f4d8b6b4 100644 --- a/src/core/features/settings/settings.module.ts +++ b/src/core/features/settings/settings.module.ts @@ -39,7 +39,7 @@ const mainMenuMoreRoutes: Routes = [ }, { path: 'preferences', - loadChildren: () => import('./pages/site/site.module').then(m => m.CoreSitePreferencesPageModule), + loadChildren: () => import('./settings-site-lazy.module').then(m => m.CoreettingsSiteLazyModule), }, ]; diff --git a/src/core/features/sharedfiles/sharedfiles.module.ts b/src/core/features/sharedfiles/sharedfiles.module.ts index 409747798..af5dbd2b9 100644 --- a/src/core/features/sharedfiles/sharedfiles.module.ts +++ b/src/core/features/sharedfiles/sharedfiles.module.ts @@ -18,7 +18,7 @@ import { Routes } from '@angular/router'; import { CoreFileUploaderDelegate } from '@features/fileuploader/services/fileuploader-delegate'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; -import { CoreSitePreferencesRoutingModule } from '@features/settings/pages/site/site-routing'; +import { CoreSitePreferencesRoutingModule } from '@features/settings/settings-site-routing.module'; import { CoreSettingsDelegate } from '@features/settings/services/settings-delegate'; import { CoreSharedFilesComponentsModule } from './components/components.module'; import { CoreSharedFilesSettingsHandler } from './services/handlers/settings'; diff --git a/src/core/features/sitehome/pages/index/index.module.ts b/src/core/features/sitehome/sitehome-lazy.module.ts similarity index 92% rename from src/core/features/sitehome/pages/index/index.module.ts rename to src/core/features/sitehome/sitehome-lazy.module.ts index f1046ba5e..82ef0772b 100644 --- a/src/core/features/sitehome/pages/index/index.module.ts +++ b/src/core/features/sitehome/sitehome-lazy.module.ts @@ -18,8 +18,7 @@ import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; import { CoreBlockComponentsModule } from '@/core/features/block/components/components.module'; import { CoreCourseComponentsModule } from '@features/course/components/components.module'; - -import { CoreSiteHomeIndexPage } from '.'; +import { CoreSiteHomeIndexPage } from '@features/sitehome/pages/index'; const routes: Routes = [ { @@ -40,4 +39,4 @@ const routes: Routes = [ ], exports: [RouterModule], }) -export class CoreSiteHomeIndexPageModule {} +export class CoreSiteHomeLazyModule {} diff --git a/src/core/features/sitehome/sitehome.module.ts b/src/core/features/sitehome/sitehome.module.ts index 40283ba13..c8d6164e9 100644 --- a/src/core/features/sitehome/sitehome.module.ts +++ b/src/core/features/sitehome/sitehome.module.ts @@ -19,7 +19,7 @@ import { CoreSiteHomeIndexLinkHandler } from './services/handlers/index-link'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreSiteHomeHomeHandler, CoreSiteHomeHomeHandlerService } from './services/handlers/sitehome-home'; import { CoreMainMenuHomeDelegate } from '@features/mainmenu/services/home-delegate'; -import { CoreMainMenuHomeRoutingModule } from '@features/mainmenu/pages/home/home-routing.module'; +import { CoreMainMenuHomeRoutingModule } from '@features/mainmenu/mainmenu-home-routing.module'; import { CoreSiteHomeProvider } from './services/sitehome'; export const CORE_SITEHOME_SERVICES: Type[] = [ @@ -29,7 +29,7 @@ export const CORE_SITEHOME_SERVICES: Type[] = [ const mainMenuHomeRoutes: Routes = [ { path: CoreSiteHomeHomeHandlerService.PAGE_NAME, - loadChildren: () => import('./pages/index/index.module').then(m => m.CoreSiteHomeIndexPageModule), + loadChildren: () => import('./sitehome-lazy.module').then(m => m.CoreSiteHomeLazyModule), }, ]; diff --git a/src/core/features/siteplugins/pages/course-option/course-option.module.ts b/src/core/features/siteplugins/pages/course-option/course-option.module.ts deleted file mode 100644 index 717060d2d..000000000 --- a/src/core/features/siteplugins/pages/course-option/course-option.module.ts +++ /dev/null @@ -1,45 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CanLeaveGuard } from '@guards/can-leave'; -import { CoreSitePluginsCourseOptionPage } from './course-option'; -import { CoreSitePluginsComponentsModule } from '../../components/components.module'; - -const routes: Routes = [ - { - path: '', - component: CoreSitePluginsCourseOptionPage, - canDeactivate: [CanLeaveGuard], - }, -]; - -/** - * Module to lazy load the page. - */ -@NgModule({ - declarations: [ - CoreSitePluginsCourseOptionPage, - ], - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreSitePluginsComponentsModule, - ], - exports: [RouterModule], -}) -export class CoreSitePluginsCourseOptionModule {} diff --git a/src/core/features/siteplugins/pages/module-index/module-index.module.ts b/src/core/features/siteplugins/pages/module-index/module-index.module.ts deleted file mode 100644 index edf9be25a..000000000 --- a/src/core/features/siteplugins/pages/module-index/module-index.module.ts +++ /dev/null @@ -1,45 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CanLeaveGuard } from '@guards/can-leave'; -import { CoreSitePluginsModuleIndexPage } from './module-index'; -import { CoreSitePluginsComponentsModule } from '../../components/components.module'; - -const routes: Routes = [ - { - path: '', - component: CoreSitePluginsModuleIndexPage, - canDeactivate: [CanLeaveGuard], - }, -]; - -/** - * Module to lazy load the page. - */ -@NgModule({ - declarations: [ - CoreSitePluginsModuleIndexPage, - ], - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreSitePluginsComponentsModule, - ], - exports: [RouterModule], -}) -export class CoreSitePluginsModuleIndexPageModule {} diff --git a/src/core/features/siteplugins/pages/plugin-page/plugin-page.module.ts b/src/core/features/siteplugins/pages/plugin-page/plugin-page.module.ts deleted file mode 100644 index 083771477..000000000 --- a/src/core/features/siteplugins/pages/plugin-page/plugin-page.module.ts +++ /dev/null @@ -1,45 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CanLeaveGuard } from '@guards/can-leave'; -import { CoreSitePluginsPluginPage } from './plugin-page'; -import { CoreSitePluginsComponentsModule } from '../../components/components.module'; - -const routes: Routes = [ - { - path: '', - component: CoreSitePluginsPluginPage, - canDeactivate: [CanLeaveGuard], - }, -]; - -/** - * Module to lazy load the page. - */ -@NgModule({ - declarations: [ - CoreSitePluginsPluginPage, - ], - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreSitePluginsComponentsModule, - ], - exports: [RouterModule], -}) -export class CoreSitePluginsPluginPageModule {} diff --git a/src/core/features/siteplugins/pages/plugin-page/plugin-page.html b/src/core/features/siteplugins/pages/plugin/plugin.html similarity index 100% rename from src/core/features/siteplugins/pages/plugin-page/plugin-page.html rename to src/core/features/siteplugins/pages/plugin/plugin.html diff --git a/src/core/features/siteplugins/pages/plugin-page/plugin-page.ts b/src/core/features/siteplugins/pages/plugin/plugin.ts similarity index 99% rename from src/core/features/siteplugins/pages/plugin-page/plugin-page.ts rename to src/core/features/siteplugins/pages/plugin/plugin.ts index 8e73791fb..644325866 100644 --- a/src/core/features/siteplugins/pages/plugin-page/plugin-page.ts +++ b/src/core/features/siteplugins/pages/plugin/plugin.ts @@ -27,7 +27,7 @@ import { CoreSitePluginsPluginContentComponent } from '../../components/plugin-c */ @Component({ selector: 'page-core-site-plugins-plugin', - templateUrl: 'plugin-page.html', + templateUrl: 'plugin.html', }) export class CoreSitePluginsPluginPage implements OnInit, CanLeave { diff --git a/src/core/features/siteplugins/siteplugins.module.ts b/src/core/features/siteplugins/siteplugins.module.ts index 61b9c7503..796e15e1e 100644 --- a/src/core/features/siteplugins/siteplugins.module.ts +++ b/src/core/features/siteplugins/siteplugins.module.ts @@ -15,39 +15,47 @@ import { APP_INITIALIZER, NgModule } from '@angular/core'; import { Routes } from '@angular/router'; -import { CoreCourseIndexRoutingModule } from '@features/course/pages/index/index-routing.module'; +import { CoreCourseIndexRoutingModule } from '@features/course/course-routing.module'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; -import { CoreMainMenuHomeRoutingModule } from '@features/mainmenu/pages/home/home-routing.module'; -import { CoreSitePreferencesRoutingModule } from '@features/settings/pages/site/site-routing'; +import { CoreMainMenuHomeRoutingModule } from '@features/mainmenu/mainmenu-home-routing.module'; +import { CoreSitePreferencesRoutingModule } from '@features/settings/settings-site-routing.module'; import { CoreSitePluginsComponentsModule } from './components/components.module'; import { CoreSitePluginsHelper } from './services/siteplugins-helper'; +import { CoreSharedModule } from '@/core/shared.module'; +import { CoreSitePluginsPluginPage } from '@features/siteplugins/pages/plugin/plugin'; +import { CanLeaveGuard } from '@guards/can-leave'; +import { CoreSitePluginsCourseOptionPage } from '@features/siteplugins/pages/course-option/course-option'; +import { CoreSitePluginsModuleIndexPage } from '@features/siteplugins/pages/module-index/module-index'; const routes: Routes = [ { path: 'siteplugins/content/:component/:method/:hash', - loadChildren: () => import('./pages/plugin-page/plugin-page.module').then( m => m.CoreSitePluginsPluginPageModule), + component: CoreSitePluginsPluginPage, + canDeactivate: [CanLeaveGuard], }, ]; const homeRoutes: Routes = [ { path: 'siteplugins/homecontent/:component/:method', - loadChildren: () => import('./pages/plugin-page/plugin-page.module').then( m => m.CoreSitePluginsPluginPageModule), + component: CoreSitePluginsPluginPage, + canDeactivate: [CanLeaveGuard], }, ]; const courseIndexRoutes: Routes = [ { path: 'siteplugins/:handlerUniqueName', - loadChildren: () => import('@features/siteplugins/pages/course-option/course-option.module') - .then(m => m.CoreSitePluginsCourseOptionModule), + component: CoreSitePluginsCourseOptionPage, + canDeactivate: [CanLeaveGuard], }, ]; const moduleRoutes: Routes = [ { path: 'siteplugins/module/:courseId/:cmId', - loadChildren: () => import('./pages/module-index/module-index.module').then( m => m.CoreSitePluginsModuleIndexPageModule), + component: CoreSitePluginsModuleIndexPage, + canDeactivate: [CanLeaveGuard], }, ]; @@ -58,6 +66,12 @@ const moduleRoutes: Routes = [ CoreMainMenuHomeRoutingModule.forChild({ children: homeRoutes }), CoreSitePreferencesRoutingModule.forChild(routes), CoreSitePluginsComponentsModule, + CoreSharedModule, + ], + declarations: [ + CoreSitePluginsPluginPage, + CoreSitePluginsCourseOptionPage, + CoreSitePluginsModuleIndexPage, ], providers: [ { diff --git a/src/core/features/tag/pages/index-area/index-area.page.module.ts b/src/core/features/tag/pages/index-area/index-area.page.module.ts deleted file mode 100644 index d049b5da5..000000000 --- a/src/core/features/tag/pages/index-area/index-area.page.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreTagIndexAreaPage } from './index-area.page'; - -const routes: Routes = [ - { - path: '', - component: CoreTagIndexAreaPage, - }, -]; - -@NgModule({ - declarations: [ - CoreTagIndexAreaPage, - ], - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - exports: [RouterModule], -}) -export class CoreTagIndexAreaPageModule {} diff --git a/src/core/features/tag/pages/index-area/index-area.page.ts b/src/core/features/tag/pages/index-area/index-area.ts similarity index 100% rename from src/core/features/tag/pages/index-area/index-area.page.ts rename to src/core/features/tag/pages/index-area/index-area.ts diff --git a/src/core/features/tag/pages/index/index.page.module.ts b/src/core/features/tag/pages/index/index.page.module.ts deleted file mode 100644 index beb24c864..000000000 --- a/src/core/features/tag/pages/index/index.page.module.ts +++ /dev/null @@ -1,57 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { conditionalRoutes } from '@/app/app-routing.module'; -import { CoreTagIndexAreaRoute } from '@features/tag/tag-lazy.module'; -import { CoreScreen } from '@services/screen'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreTagIndexPage } from './index.page'; - -const mobileRoutes: Routes = [ - { - path: '', - component: CoreTagIndexPage, - }, - CoreTagIndexAreaRoute, -]; - -const tabletRoutes: Routes = [ - { - path: '', - component: CoreTagIndexPage, - children: [ - CoreTagIndexAreaRoute, - ], - }, -]; - -const routes: Routes = [ - ...conditionalRoutes(mobileRoutes, () => CoreScreen.isMobile), - ...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet), -]; - -@NgModule({ - declarations: [ - CoreTagIndexPage, - ], - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - exports: [RouterModule], -}) -export class CoreTagIndexPageModule {} diff --git a/src/core/features/tag/pages/index/index.page.ts b/src/core/features/tag/pages/index/index.ts similarity index 100% rename from src/core/features/tag/pages/index/index.page.ts rename to src/core/features/tag/pages/index/index.ts diff --git a/src/core/features/tag/pages/search/search.page.module.ts b/src/core/features/tag/pages/search/search.page.module.ts deleted file mode 100644 index 5519cb3ac..000000000 --- a/src/core/features/tag/pages/search/search.page.module.ts +++ /dev/null @@ -1,42 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreSearchComponentsModule } from '@features/search/components/components.module'; - -import { CoreTagSearchPage } from './search.page'; -import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/components.module'; - -const routes: Routes = [ - { - path: '', - component: CoreTagSearchPage, - }, -]; -@NgModule({ - declarations: [ - CoreTagSearchPage, - ], - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreSearchComponentsModule, - CoreMainMenuComponentsModule, - ], - exports: [RouterModule], -}) -export class CoreTagSearchPageModule {} diff --git a/src/core/features/tag/pages/search/search.page.ts b/src/core/features/tag/pages/search/search.ts similarity index 100% rename from src/core/features/tag/pages/search/search.page.ts rename to src/core/features/tag/pages/search/search.ts diff --git a/src/core/features/tag/tag-lazy.module.ts b/src/core/features/tag/tag-lazy.module.ts index 6ced82dfe..83079cbcb 100644 --- a/src/core/features/tag/tag-lazy.module.ts +++ b/src/core/features/tag/tag-lazy.module.ts @@ -12,32 +12,62 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { conditionalRoutes } from '@/app/app-routing.module'; +import { CoreSharedModule } from '@/core/shared.module'; import { Injector, NgModule } from '@angular/core'; import { Route, RouterModule, ROUTES, Routes } from '@angular/router'; +import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/components.module'; import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.module'; +import { CoreSearchComponentsModule } from '@features/search/components/components.module'; +import { CoreTagIndexAreaPage } from '@features/tag/pages/index-area/index-area'; +import { CoreTagIndexPage } from '@features/tag/pages/index/index'; +import { CoreTagSearchPage } from '@features/tag/pages/search/search'; +import { CoreScreen } from '@services/screen'; import { CoreTagMainMenuHandlerService } from './services/handlers/mainmenu'; -export const CoreTagIndexAreaRoute: Route = { +const indexAreaRoute: Route = { path: 'index-area', - loadChildren: () => - import('@features/tag/pages/index-area/index-area.page.module').then(m => m.CoreTagIndexAreaPageModule), + component: CoreTagIndexAreaPage, }; +/** + * Build module routes. + * + * @param injector Injector. + * @returns Routes. + */ function buildRoutes(injector: Injector): Routes { - return [ + const mobileRoutes: Routes = [ { path: 'index', - loadChildren: () => import('@features/tag/pages/index/index.page.module').then(m => m.CoreTagIndexPageModule), + component: CoreTagIndexPage, }, { - path: 'search', - data: { - mainMenuTabRoot: CoreTagMainMenuHandlerService.PAGE_NAME, - }, - loadChildren: () => import('@features/tag/pages/search/search.page.module').then(m => m.CoreTagSearchPageModule), + ...indexAreaRoute, + path: `${indexAreaRoute.path}/index`, }, - CoreTagIndexAreaRoute, + ]; + + const tabletRoutes: Routes = [ + { + path: 'index', + component: CoreTagIndexPage, + children: [ + indexAreaRoute, + ], + }, + ]; + + return [ + ...conditionalRoutes(mobileRoutes, () => CoreScreen.isMobile), + ...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet), + { + path: 'search', + data: { mainMenuTabRoot: CoreTagMainMenuHandlerService.PAGE_NAME }, + component: CoreTagSearchPage, + }, + indexAreaRoute, ...buildTabMainRoutes(injector, { redirectTo: 'search', pathMatch: 'full', @@ -46,6 +76,16 @@ function buildRoutes(injector: Injector): Routes { } @NgModule({ + imports: [ + CoreSharedModule, + CoreSearchComponentsModule, + CoreMainMenuComponentsModule, + ], + declarations: [ + CoreTagIndexPage, + CoreTagSearchPage, + CoreTagIndexAreaPage, + ], exports: [RouterModule], providers: [ { @@ -56,4 +96,4 @@ function buildRoutes(injector: Injector): Routes { }, ], }) -export class CoreTagLazyModule { } +export class CoreTagLazyModule {} diff --git a/src/core/features/user/pages/about/about.module.ts b/src/core/features/user/pages/about/about.module.ts deleted file mode 100644 index a40c76fc6..000000000 --- a/src/core/features/user/pages/about/about.module.ts +++ /dev/null @@ -1,41 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreUserComponentsModule } from '@features/user/components/components.module'; - -import { CoreUserAboutPage } from './about.page'; - -const routes: Routes = [ - { - path: '', - component: CoreUserAboutPage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - CoreUserComponentsModule, - ], - declarations: [ - CoreUserAboutPage, - ], - exports: [RouterModule], -}) -export class CoreUserAboutPageModule {} diff --git a/src/core/features/user/pages/about/about.page.ts b/src/core/features/user/pages/about/about.ts similarity index 100% rename from src/core/features/user/pages/about/about.page.ts rename to src/core/features/user/pages/about/about.ts diff --git a/src/core/features/user/pages/participants/participants.page.ts b/src/core/features/user/pages/participants/participants.ts similarity index 100% rename from src/core/features/user/pages/participants/participants.page.ts rename to src/core/features/user/pages/participants/participants.ts diff --git a/src/core/features/user/pages/profile/profile.page.ts b/src/core/features/user/pages/profile/profile.ts similarity index 100% rename from src/core/features/user/pages/profile/profile.page.ts rename to src/core/features/user/pages/profile/profile.ts diff --git a/src/core/features/user/user-course-lazy.module.ts b/src/core/features/user/user-course-lazy.module.ts index 9992c1ff1..e7fe47eb7 100644 --- a/src/core/features/user/user-course-lazy.module.ts +++ b/src/core/features/user/user-course-lazy.module.ts @@ -18,7 +18,7 @@ import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; import { CoreSearchComponentsModule } from '@features/search/components/components.module'; -import { CoreUserParticipantsPage } from './pages/participants/participants.page'; +import { CoreUserParticipantsPage } from './pages/participants/participants'; import { conditionalRoutes } from '@/app/app-routing.module'; import { CoreScreen } from '@services/screen'; @@ -29,7 +29,7 @@ const routes: Routes = [ children: conditionalRoutes([ { path: ':userId', - loadChildren: () => import('@features/user/pages/profile/profile.module').then(m => m.CoreUserProfilePageModule), + loadChildren: () => import('@features/user/user-profile-lazy.module').then(m => m.CoreUserProfileLazyModule), }, ], () => CoreScreen.isTablet), }, diff --git a/src/core/features/user/user-lazy.module.ts b/src/core/features/user/user-lazy.module.ts index b7f04d730..f76ce4e06 100644 --- a/src/core/features/user/user-lazy.module.ts +++ b/src/core/features/user/user-lazy.module.ts @@ -12,8 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { CoreSharedModule } from '@/core/shared.module'; import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { CoreUserComponentsModule } from '@features/user/components/components.module'; +import { CoreUserAboutPage } from '@features/user/pages/about/about'; const routes: Routes = [ { @@ -23,15 +26,22 @@ const routes: Routes = [ }, { path: 'profile', - loadChildren: () => import('./pages/profile/profile.module').then( m => m.CoreUserProfilePageModule), + loadChildren: () => import('./user-profile-lazy.module').then( m => m.CoreUserProfileLazyModule), }, { path: 'about', - loadChildren: () => import('./pages/about/about.module').then( m => m.CoreUserAboutPageModule), + component: CoreUserAboutPage, }, ]; @NgModule({ - imports: [RouterModule.forChild(routes)], + imports: [ + RouterModule.forChild(routes), + CoreSharedModule, + CoreUserComponentsModule, + ], + declarations: [ + CoreUserAboutPage, + ], }) export class CoreUserLazyModule {} diff --git a/src/core/features/user/pages/profile/profile.module.ts b/src/core/features/user/user-profile-lazy.module.ts similarity index 89% rename from src/core/features/user/pages/profile/profile.module.ts rename to src/core/features/user/user-profile-lazy.module.ts index 4a8aad735..926b471c7 100644 --- a/src/core/features/user/pages/profile/profile.module.ts +++ b/src/core/features/user/user-profile-lazy.module.ts @@ -16,7 +16,7 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; -import { CoreUserProfilePage } from './profile.page'; +import { CoreUserProfilePage } from '@features/user/pages/profile/profile'; const routes: Routes = [ { @@ -35,4 +35,4 @@ const routes: Routes = [ ], exports: [RouterModule], }) -export class CoreUserProfilePageModule {} +export class CoreUserProfileLazyModule {} diff --git a/src/core/features/user/user.module.ts b/src/core/features/user/user.module.ts index d231658db..d28b91aaa 100644 --- a/src/core/features/user/user.module.ts +++ b/src/core/features/user/user.module.ts @@ -27,7 +27,7 @@ import { CoreCronDelegate } from '@services/cron'; import { CoreUserSyncCronHandler } from './services/handlers/sync-cron'; import { CoreUserTagAreaHandler } from './services/handlers/tag-area'; import { CoreTagAreaDelegate } from '@features/tag/services/tag-area-delegate'; -import { CoreCourseIndexRoutingModule } from '@features/course/pages/index/index-routing.module'; +import { CoreCourseIndexRoutingModule } from '@features/course/course-routing.module'; import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate'; import { CoreUserCourseOptionHandler } from './services/handlers/course-option'; import { CoreUserProfileFieldDelegateService } from './services/user-profile-field-delegate'; @@ -67,7 +67,7 @@ const routes: Routes = [ ...conditionalRoutes([ { path: `${COURSE_PAGE_NAME}/${COURSE_INDEX_PATH}/${PARTICIPANTS_PAGE_NAME}/:userId`, - loadChildren: () => import('@features/user/pages/profile/profile.module').then(m => m.CoreUserProfilePageModule), + loadChildren: () => import('@features/user/user-profile-lazy.module').then(m => m.CoreUserProfileLazyModule), data: { swipeManagerSource: 'participants', }, diff --git a/src/core/features/viewer/pages/iframe/iframe.module.ts b/src/core/features/viewer/pages/iframe/iframe.module.ts deleted file mode 100644 index 9a8e7380c..000000000 --- a/src/core/features/viewer/pages/iframe/iframe.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (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. - -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreViewerIframePage } from './iframe'; - -const routes: Routes = [ - { - path: '', - component: CoreViewerIframePage, - }, -]; - -@NgModule({ - imports: [ - RouterModule.forChild(routes), - CoreSharedModule, - ], - declarations: [ - CoreViewerIframePage, - ], - exports: [RouterModule], -}) -export class CoreViewerIframePageModule {} diff --git a/src/core/features/viewer/viewer-lazy.module.ts b/src/core/features/viewer/viewer-lazy.module.ts index 99649b6af..c6f4e8049 100644 --- a/src/core/features/viewer/viewer-lazy.module.ts +++ b/src/core/features/viewer/viewer-lazy.module.ts @@ -12,17 +12,25 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { CoreSharedModule } from '@/core/shared.module'; import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { CoreViewerIframePage } from '@features/viewer/pages/iframe/iframe'; const routes: Routes = [ { path: 'iframe', - loadChildren: () => import('./pages/iframe/iframe.module').then( m => m.CoreViewerIframePageModule), + component: CoreViewerIframePage, }, ]; @NgModule({ - imports: [RouterModule.forChild(routes)], + imports: [ + RouterModule.forChild(routes), + CoreSharedModule, + ], + declarations: [ + CoreViewerIframePage, + ], }) export class CoreViewerLazyModule {} From 605d1c09a4b6df171402a524e474d0a6cc5eef19 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Mon, 13 Mar 2023 10:42:40 +0100 Subject: [PATCH 4/4] MOBILE-4270 course: Remove summary component This hasn't been used for a long time, so it can be removed. --- .../components/course-format/course-format.ts | 11 --------- .../course/services/format-delegate.ts | 23 ------------------- upgrade.txt | 1 + 3 files changed, 1 insertion(+), 34 deletions(-) diff --git a/src/core/features/course/components/course-format/course-format.ts b/src/core/features/course/components/course-format/course-format.ts index 3d6e4ce36..60514d716 100644 --- a/src/core/features/course/components/course-format/course-format.ts +++ b/src/core/features/course/components/course-format/course-format.ts @@ -81,7 +81,6 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { // All the possible component classes. courseFormatComponent?: Type; - courseSummaryComponent?: Type; singleSectionComponent?: Type; allSectionsComponent?: Type; @@ -230,7 +229,6 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { await Promise.all([ this.loadCourseFormatComponent(), - this.loadCourseSummaryComponent(), this.loadSingleSectionComponent(), this.loadAllSectionsComponent(), ]); @@ -246,15 +244,6 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { this.courseFormatComponent = await CoreCourseFormatDelegate.getCourseFormatComponent(this.course); } - /** - * Load course summary component. - * - * @returns Promise resolved when done. - */ - protected async loadCourseSummaryComponent(): Promise { - this.courseSummaryComponent = await CoreCourseFormatDelegate.getCourseSummaryComponent(this.course); - } - /** * Load single section component. * diff --git a/src/core/features/course/services/format-delegate.ts b/src/core/features/course/services/format-delegate.ts index 59b1f5b4a..5118d550a 100644 --- a/src/core/features/course/services/format-delegate.ts +++ b/src/core/features/course/services/format-delegate.ts @@ -136,15 +136,6 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { */ getCourseFormatComponent?(course: CoreCourseAnyCourseData): Promise | undefined>; - /** - * Return the Component to use to display the course summary inside the default course format. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @param course The course to render. - * @returns Promise resolved with component to use, undefined if not found. - */ - getCourseSummaryComponent?(course: CoreCourseAnyCourseData): Promise | undefined>; - /** * Return the Component to use to display a single section. This component will only be used if the user is viewing a * single section. If all the sections are displayed at once then it won't be used. @@ -273,20 +264,6 @@ export class CoreCourseFormatDelegateService extends CoreDelegate | undefined> { - try { - return await this.executeFunctionOnEnabled>(course.format || '', 'getCourseSummaryComponent', [course]); - } catch (error) { - this.logger.error('Error getting course summary component', error); - } - } - /** * Given a course, return the title to use in the course page. * diff --git a/upgrade.txt b/upgrade.txt index 8e951b16e..c58c29806 100644 --- a/upgrade.txt +++ b/upgrade.txt @@ -4,6 +4,7 @@ information provided here is intended especially for developers. === 4.2.0 === - CoreIconComponent has been removed after deprecation period: Use CoreFaIconDirective instead. +- The courseSummaryComponent property has been removed from the CoreCourseFormatComponent component, and the getCourseSummaryComponent method from the CoreCourseFormatHandler interface. === 4.1.0 ===