MOBILE-4081 course: Load 'course-summary.module' from service
parent
ceae5d701c
commit
7a83c7711e
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
import { CoreCourseHelper } from './services/course-helper';
|
||||||
|
|
||||||
export const COURSE_INDEX_PATH = ':courseId';
|
export const COURSE_INDEX_PATH = ':courseId';
|
||||||
|
|
||||||
|
@ -33,8 +34,7 @@ const routes: Routes = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':courseId/summary',
|
path: ':courseId/summary',
|
||||||
loadChildren: () =>
|
loadChildren: () => CoreCourseHelper.getCourseSummaryRouteModule(),
|
||||||
import('./pages/course-summary/course-summary.module').then(m => m.CoreCourseSummaryPageModule),
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ import { CoreUtils } from '@services/utils/utils';
|
||||||
import { CoreNavigationOptions, CoreNavigator } from '@services/navigator';
|
import { CoreNavigationOptions, CoreNavigator } from '@services/navigator';
|
||||||
import { CONTENTS_PAGE_NAME } from '@features/course/course.module';
|
import { CONTENTS_PAGE_NAME } from '@features/course/course.module';
|
||||||
import { CoreDomUtils } from '@services/utils/dom';
|
import { CoreDomUtils } from '@services/utils/dom';
|
||||||
import { CoreCourseSummaryPage } from '../course-summary/course-summary';
|
|
||||||
import { CoreCoursesHelper, CoreCourseWithImageAndColor } from '@features/courses/services/courses-helper';
|
import { CoreCoursesHelper, CoreCourseWithImageAndColor } from '@features/courses/services/courses-helper';
|
||||||
import { CoreColors } from '@singletons/colors';
|
import { CoreColors } from '@singletons/colors';
|
||||||
import { CoreText } from '@singletons/text';
|
import { CoreText } from '@singletons/text';
|
||||||
|
@ -288,17 +287,9 @@ export class CoreCourseIndexPage implements OnInit, OnDestroy {
|
||||||
* Open the course summary
|
* Open the course summary
|
||||||
*/
|
*/
|
||||||
openCourseSummary(): void {
|
openCourseSummary(): void {
|
||||||
if (!this.course) {
|
if (this.course) {
|
||||||
return;
|
CoreCourseHelper.openCourseSummary(this.course);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreDomUtils.openSideModal<void>({
|
|
||||||
component: CoreCourseSummaryPage,
|
|
||||||
componentProps: {
|
|
||||||
courseId: this.course.id,
|
|
||||||
course: this.course,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -70,6 +70,8 @@ import { CoreSiteHome } from '@features/sitehome/services/sitehome';
|
||||||
import { CoreNavigationOptions, CoreNavigator } from '@services/navigator';
|
import { CoreNavigationOptions, CoreNavigator } from '@services/navigator';
|
||||||
import { CoreSiteHomeHomeHandlerService } from '@features/sitehome/services/handlers/sitehome-home';
|
import { CoreSiteHomeHomeHandlerService } from '@features/sitehome/services/handlers/sitehome-home';
|
||||||
import { CoreStatusWithWarningsWSResponse } from '@services/ws';
|
import { CoreStatusWithWarningsWSResponse } from '@services/ws';
|
||||||
|
import { CoreCourseWithImageAndColor } from '@features/courses/services/courses-helper';
|
||||||
|
import { CoreCourseSummaryPage } from '../pages/course-summary/course-summary';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prefetch info of a module.
|
* Prefetch info of a module.
|
||||||
|
@ -2033,6 +2035,30 @@ export class CoreCourseHelperProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves course summary page module.
|
||||||
|
*
|
||||||
|
* @returns Course summary page module.
|
||||||
|
*/
|
||||||
|
async getCourseSummaryRouteModule(): Promise<unknown> {
|
||||||
|
return import('../pages/course-summary/course-summary.module').then(m => m.CoreCourseSummaryPageModule);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open course summary in side modal.
|
||||||
|
*
|
||||||
|
* @param course Course selected
|
||||||
|
*/
|
||||||
|
openCourseSummary(course: CoreCourseWithImageAndColor & CoreCourseAnyCourseData): void {
|
||||||
|
CoreDomUtils.openSideModal<void>({
|
||||||
|
component: CoreCourseSummaryPage,
|
||||||
|
componentProps: {
|
||||||
|
courseId: course.id,
|
||||||
|
course: course,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CoreCourseHelper = makeSingleton(CoreCourseHelperProvider);
|
export const CoreCourseHelper = makeSingleton(CoreCourseHelperProvider);
|
||||||
|
|
Loading…
Reference in New Issue