diff --git a/src/core/features/course/pages/module-preview/module-preview.html b/src/core/features/course/pages/module-preview/module-preview.html index 242d4baae..4995c5aa9 100644 --- a/src/core/features/course/pages/module-preview/module-preview.html +++ b/src/core/features/course/pages/module-preview/module-preview.html @@ -15,6 +15,9 @@ [showBrowserWarning]="false" [attr.aria-label]="'core.openinbrowser' | translate"> + + + diff --git a/src/core/features/course/pages/module-preview/module-preview.ts b/src/core/features/course/pages/module-preview/module-preview.ts index eb5dbee34..5779ea379 100644 --- a/src/core/features/course/pages/module-preview/module-preview.ts +++ b/src/core/features/course/pages/module-preview/module-preview.ts @@ -13,6 +13,10 @@ // limitations under the License. import { Component, OnInit } from '@angular/core'; +import { + CoreCourseModuleSummaryResult, + CoreCourseModuleSummaryComponent, +} from '@features/course/components/module-summary/module-summary'; import { CoreCourse } from '@features/course/services/course'; import { CoreCourseHelper, CoreCourseModuleData, CoreCourseSection } from '@features/course/services/course-helper'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; @@ -92,6 +96,41 @@ export class CoreCourseModulePreviewPage implements OnInit { this.loaded = true; } + /** + * Opens a module summary page. + */ + async openModuleSummary(): Promise { + if (!this.module) { + return; + } + + const data = await CoreDomUtils.openSideModal({ + component: CoreCourseModuleSummaryComponent, + componentProps: { + moduleId: this.module.id, + module: this.module, + description: this.module.description, + component: this.module.modname, + courseId: this.courseId, + displayOptions: { + displayDescription: false, + displayBlog: false, + }, + }, + }); + + if (data) { + if (this.loaded && data.action == 'refresh') { + this.loaded = false; + try { + await this.doRefresh(undefined); + } finally { + this.loaded = true; + } + } + } + } + /** * Refresh the data. *