MOBILE-4250 module: Add module summary to preview module page
This commit is contained in:
		
							parent
							
								
									9d1d433489
								
							
						
					
					
						commit
						5ef41c6ace
					
				@ -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>
 | 
			
		||||
 | 
			
		||||
@ -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.
 | 
			
		||||
     *
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user