Merge pull request #3620 from crazyserver/MOBILE-4250

MOBILE-4250 module: Add module summary to preview module page
main
Dani Palou 2023-04-19 12:03:57 +02:00 committed by GitHub
commit 825c1617f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 0 deletions

View File

@ -15,6 +15,9 @@
[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-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-toolbar>
</ion-header>

View File

@ -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<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.
*