forked from EVOgeek/Vmeda.Online
		
	Merge pull request #3371 from alfonso-salces/MOBILE-4081
MOBILE-4081 course: Load 'course-summary.module' from service
This commit is contained in:
		
						commit
						9249fab7ee
					
				| @ -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, |  | ||||||
|             }, |  | ||||||
|         }); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | |||||||
| @ -71,6 +71,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. | ||||||
| @ -2034,6 +2036,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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user