MOBILE-4250 module: Add module summary to preview module page

main
Pau Ferrer Ocaña 2023-04-19 11:19:15 +02:00
parent 9d1d433489
commit 5ef41c6ace
2 changed files with 42 additions and 0 deletions

View File

@ -15,6 +15,9 @@
[showBrowserWarning]="false" [attr.aria-label]="'core.openinbrowser' | translate"> [showBrowserWarning]="false" [attr.aria-label]="'core.openinbrowser' | translate">
<ion-icon name="fas-up-right-from-square" slot="icon-only" aria-hidden="true"></ion-icon> <ion-icon name="fas-up-right-from-square" slot="icon-only" aria-hidden="true"></ion-icon>
</ion-button> </ion-button>
<ion-button fill="clear" (click)="openModuleSummary()" aria-haspopup="true" [attr.aria-label]="'core.info' | translate">
<ion-icon name="fas-circle-info" slot="icon-only" aria-hidden="true"></ion-icon>
</ion-button>
</ion-buttons> </ion-buttons>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>

View File

@ -13,6 +13,10 @@
// limitations under the License. // limitations under the License.
import { Component, OnInit } from '@angular/core'; 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 { CoreCourse } from '@features/course/services/course';
import { CoreCourseHelper, CoreCourseModuleData, CoreCourseSection } from '@features/course/services/course-helper'; import { CoreCourseHelper, CoreCourseModuleData, CoreCourseSection } from '@features/course/services/course-helper';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
@ -92,6 +96,41 @@ export class CoreCourseModulePreviewPage implements OnInit {
this.loaded = true; this.loaded = true;
} }
/**
* Opens a module summary page.
*/
async openModuleSummary(): Promise<void> {
if (!this.module) {
return;
}
const data = await CoreDomUtils.openSideModal<CoreCourseModuleSummaryResult>({
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. * Refresh the data.
* *