MOBILE-3814 mod: Move completion to course module navigation component

main
Pau Ferrer Ocaña 2022-01-19 15:22:10 +01:00
parent 4a83b2b29f
commit 6998c05d5c
28 changed files with 98 additions and 96 deletions

View File

@ -30,8 +30,8 @@
<core-loading [hideUntil]="loaded"> <core-loading [hideUntil]="loaded">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
[component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline"> [courseId]="courseId" [hasDataToSync]="hasOffline">
<ion-list inset="true" description *ngIf="assign && assign.introattachments && assign.introattachments.length"> <ion-list inset="true" description *ngIf="assign && assign.introattachments && assign.introattachments.length">
<core-file *ngFor="let file of assign.introattachments" [file]="file" [component]="component" [componentId]="componentId"> <core-file *ngFor="let file of assign.introattachments" [file]="file" [component]="component" [componentId]="componentId">
</core-file> </core-file>
@ -148,4 +148,5 @@
</addon-mod-assign-submission> </addon-mod-assign-submission>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"></core-course-module-navigation> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation>

View File

@ -23,8 +23,8 @@
<core-loading [hideUntil]="loaded" class="safe-area-page"> <core-loading [hideUntil]="loaded" class="safe-area-page">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
[component]="component" [componentId]="componentId" [courseId]="courseId"> [courseId]="courseId">
</core-course-module-info> </core-course-module-info>
<ng-container *ngIf="groupInfo && (groupInfo.separateGroups || groupInfo.visibleGroups)"> <ng-container *ngIf="groupInfo && (groupInfo.separateGroups || groupInfo.visibleGroups)">
@ -126,5 +126,5 @@
</ng-container> </ng-container>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>

View File

@ -24,8 +24,8 @@
<core-loading [hideUntil]="loaded"> <core-loading [hideUntil]="loaded">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
[component]="component" [componentId]="componentId" [courseId]="courseId"> [courseId]="courseId">
</core-course-module-info> </core-course-module-info>
<ion-card class="core-warning-card" *ngIf="warning"> <ion-card class="core-warning-card" *ngIf="warning">
@ -56,5 +56,5 @@
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>

View File

@ -27,8 +27,8 @@
<core-loading [hideUntil]="loaded" class="safe-area-padding"> <core-loading [hideUntil]="loaded" class="safe-area-padding">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
[component]="component" [componentId]="componentId" [courseId]="courseId"> [courseId]="courseId">
</core-course-module-info> </core-course-module-info>
<ion-card *ngIf="chatInfo" class="core-info-card"> <ion-card *ngIf="chatInfo" class="core-info-card">
@ -48,5 +48,5 @@
</ng-container> </ng-container>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>

View File

@ -29,8 +29,8 @@
<core-loading [hideUntil]="loaded"> <core-loading [hideUntil]="loaded">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
[component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline"> [courseId]="courseId" [hasDataToSync]="hasOffline">
</core-course-module-info> </core-course-module-info>
<!-- Activity availability messages --> <!-- Activity availability messages -->
@ -155,7 +155,7 @@
</ion-card> </ion-card>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>
<!-- Template to render a choice option label. --> <!-- Template to render a choice option label. -->

View File

@ -39,8 +39,8 @@
<core-loading [hideUntil]="loaded"> <core-loading [hideUntil]="loaded">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
[component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings"> [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings">
</core-course-module-info> </core-course-module-info>
<ion-item class="ion-text-wrap" *ngIf="groupInfo && (groupInfo.separateGroups || groupInfo.visibleGroups)"> <ion-item class="ion-text-wrap" *ngIf="groupInfo && (groupInfo.separateGroups || groupInfo.visibleGroups)">
@ -138,7 +138,7 @@
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="canAdd"> <ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="canAdd">

View File

@ -29,8 +29,8 @@
<core-loading [hideUntil]="loaded"> <core-loading [hideUntil]="loaded">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
[component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline"> [courseId]="courseId" [hasDataToSync]="hasOffline">
</core-course-module-info> </core-course-module-info>
<core-tabs [hideUntil]="tabsReady" [selectedIndex]="firstSelectedTab"> <core-tabs [hideUntil]="tabsReady" [selectedIndex]="firstSelectedTab">
@ -55,7 +55,7 @@
</core-tabs> </core-tabs>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>
<ng-template #basicInfo> <ng-template #basicInfo>

View File

@ -26,8 +26,8 @@
<core-loading [hideUntil]="loaded"> <core-loading [hideUntil]="loaded">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info *ngIf="!subfolder" [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info *ngIf="!subfolder" [module]="module" [description]="description" [component]="component"
[component]="component" [componentId]="componentId" [courseId]="courseId"> [componentId]="componentId" [courseId]="courseId">
</core-course-module-info> </core-course-module-info>
<ion-list *ngIf="contents && (contents.files.length + contents.folders.length > 0)"> <ion-list *ngIf="contents && (contents.files.length + contents.folders.length > 0)">
@ -49,5 +49,5 @@
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>

View File

@ -38,9 +38,8 @@
<core-loading [hideUntil]="discussions && discussions.loaded"> <core-loading [hideUntil]="discussions && discussions.loaded">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" <core-course-module-info [module]="module" [description]="forum && forum.type != 'single' && description" [component]="component"
[description]="forum && forum.type != 'single' && description" [component]="component" [componentId]="componentId" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings">
[courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings">
<ion-item lines="none" class="ion-text-wrap"> <ion-item lines="none" class="ion-text-wrap">
<ion-label> <ion-label>
{{descriptionNote}} {{descriptionNote}}
@ -140,7 +139,8 @@
</ng-container> </ng-container>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="forum && canAddDiscussion"> <ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="forum && canAddDiscussion">

View File

@ -50,8 +50,8 @@
<core-loading [hideUntil]="loaded"> <core-loading [hideUntil]="loaded">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info *ngIf="!isSearch" [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info *ngIf="!isSearch" [module]="module" [description]="description" [component]="component"
[component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings"> [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings">
</core-course-module-info> </core-course-module-info>
<ion-list *ngIf="!isSearch && entries && entries.offlineEntries.length > 0"> <ion-list *ngIf="!isSearch && entries && entries.offlineEntries.length > 0">
@ -96,7 +96,8 @@
</core-infinite-loading> </core-infinite-loading>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="canAdd"> <ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="canAdd">

View File

@ -36,8 +36,8 @@
<core-loading [hideUntil]="loaded" class="safe-area-padding"> <core-loading [hideUntil]="loaded" class="safe-area-padding">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
[component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline"> [courseId]="courseId" [hasDataToSync]="hasOffline">
</core-course-module-info> </core-course-module-info>
<!-- Offline disabled. --> <!-- Offline disabled. -->
@ -85,5 +85,5 @@
</core-h5p-iframe> </core-h5p-iframe>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>

View File

@ -29,7 +29,7 @@
<core-loading [hideUntil]="loaded" class="safe-area-padding"> <core-loading [hideUntil]="loaded" class="safe-area-padding">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()"> <core-course-module-info [module]="module">
</core-course-module-info> </core-course-module-info>
<ion-card class="core-warning-card" *ngIf="warning"> <ion-card class="core-warning-card" *ngIf="warning">
@ -46,5 +46,5 @@
</div> </div>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>

View File

@ -33,8 +33,8 @@
<ng-template> <ng-template>
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
[component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline"> [courseId]="courseId" [hasDataToSync]="hasOffline">
</core-course-module-info> </core-course-module-info>
<!-- Prevent access messages. Only show the first one. --> <!-- Prevent access messages. Only show the first one. -->
@ -298,5 +298,5 @@
</core-tabs> </core-tabs>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>

View File

@ -20,9 +20,8 @@
<core-loading [hideUntil]="loaded" class="safe-area-padding"> <core-loading [hideUntil]="loaded" class="safe-area-padding">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" <core-course-module-info [module]="module" [description]="lti && lti.showdescriptionlaunch && description" [component]="component"
[description]="lti && lti.showdescriptionlaunch && description" [component]="component" [componentId]="componentId" [componentId]="componentId" [courseId]="courseId">
[courseId]="courseId">
</core-course-module-info> </core-course-module-info>
<div class="ion-padding"> <div class="ion-padding">
@ -33,5 +32,5 @@
</div> </div>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>

View File

@ -26,8 +26,8 @@
<core-loading [hideUntil]="loaded" class="safe-area-padding"> <core-loading [hideUntil]="loaded" class="safe-area-padding">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="displayDescription && description" <core-course-module-info [module]="module" [description]="displayDescription && description" [component]="component"
[component]="component" [componentId]="componentId" [courseId]="courseId"> [componentId]="componentId" [courseId]="courseId">
</core-course-module-info> </core-course-module-info>
<ion-card class="core-warning-card" *ngIf="warning"> <ion-card class="core-warning-card" *ngIf="warning">
@ -49,5 +49,5 @@
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>

View File

@ -29,9 +29,8 @@
<core-loading [hideUntil]="loaded"> <core-loading [hideUntil]="loaded">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
[component]="component" [componentId]="componentId" [courseId]="courseId" [courseId]="courseId" [hasDataToSync]="buttonText && hasOffline && !showStatusSpinner">
[hasDataToSync]="buttonText && hasOffline && !showStatusSpinner">
</core-course-module-info> </core-course-module-info>
<!-- Access rules description messages. --> <!-- Access rules description messages. -->
@ -227,5 +226,5 @@
</ion-card> </ion-card>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>

View File

@ -21,7 +21,7 @@
<core-loading [hideUntil]="loaded" class="safe-area-padding"> <core-loading [hideUntil]="loaded" class="safe-area-padding">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" [courseId]="courseId" (completionChanged)="onCompletionChange()" <core-course-module-info [module]="module" [courseId]="courseId"
[description]="mode != 'iframe' && (mode != 'embedded' || displayDescription) && description" [component]="component" [description]="mode != 'iframe' && (mode != 'embedded' || displayDescription) && description" [component]="component"
[componentId]="componentId"> [componentId]="componentId">
</core-course-module-info> </core-course-module-info>
@ -61,5 +61,5 @@
</ng-container> </ng-container>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>

View File

@ -29,8 +29,8 @@
<core-loading [hideUntil]="loaded" class="safe-area-padding"> <core-loading [hideUntil]="loaded" class="safe-area-padding">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
[component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="!errorMessage && hasOffline"> [courseId]="courseId" [hasDataToSync]="!errorMessage && hasOffline">
</core-course-module-info> </core-course-module-info>
<!-- Warning message. --> <!-- Warning message. -->
@ -237,5 +237,5 @@
</ng-container> </ng-container>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>

View File

@ -30,9 +30,8 @@
<core-loading [hideUntil]="loaded" class="safe-area-padding"> <core-loading [hideUntil]="loaded" class="safe-area-padding">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" <core-course-module-info [module]="module" [description]="survey && !survey.surveydone && !hasOffline && description"
[description]="survey && !survey.surveydone && !hasOffline && description" [component]="component" [componentId]="componentId" [component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline">
[courseId]="courseId" [hasDataToSync]="hasOffline">
</core-course-module-info> </core-course-module-info>
<!-- Survey already done --> <!-- Survey already done -->
@ -148,5 +147,5 @@
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>

View File

@ -16,8 +16,8 @@
<core-loading [hideUntil]="loaded"> <core-loading [hideUntil]="loaded">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="displayDescription && description" <core-course-module-info [module]="module" [description]="displayDescription && description" [component]="component"
[component]="component" [componentId]="componentId" [courseId]="courseId"> [componentId]="componentId" [courseId]="courseId">
</core-course-module-info> </core-course-module-info>
<div *ngIf="shouldIframe || (shouldEmbed && isOther)" class="addon-mod_url-embedded-url"> <div *ngIf="shouldIframe || (shouldEmbed && isOther)" class="addon-mod_url-embedded-url">
@ -53,5 +53,5 @@
</ion-list> </ion-list>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>

View File

@ -48,8 +48,8 @@
<core-loading [hideUntil]="loaded"> <core-loading [hideUntil]="loaded">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
[component]="component" [componentId]="componentId" [courseId]="courseId"> [courseId]="courseId">
</core-course-module-info> </core-course-module-info>
<div *ngIf="pageIsOffline || hasOffline || pageWarning"> <div *ngIf="pageIsOffline || hasOffline || pageWarning">
@ -89,7 +89,7 @@
</div> </div>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="canEdit"> <ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="canEdit">

View File

@ -30,7 +30,7 @@
<core-loading [hideUntil]="loaded"> <core-loading [hideUntil]="loaded">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [hasDataToSync]="hasOffline"> <core-course-module-info [module]="module" [hasDataToSync]="hasOffline">
</core-course-module-info> </core-course-module-info>
<ion-card *ngIf="phases"> <ion-card *ngIf="phases">
@ -254,5 +254,5 @@
</div> </div>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
</core-course-module-navigation> </core-course-module-navigation>

View File

@ -19,21 +19,12 @@
</ion-label> </ion-label>
</ion-item> </ion-item>
<ng-content select="[description]"></ng-content> <ng-content select="[description]"></ng-content>
<ion-item class="ion-text-wrap" lines="none" *ngIf="showCompletion && (module.dates?.length ||
(module.completiondata && (module.completiondata.isautomatic || showManualCompletion) && module.uservisible))">
<ion-label>
<!-- Activity dates. --> <!-- Activity dates. -->
<div *ngIf="module.dates?.length" class="core-module-dates"> <ion-item class="ion-text-wrap core-module-dates" lines="none" *ngIf="showCompletion && module.dates?.length">
<ion-label>
<p *ngFor="let date of module.dates"> <p *ngFor="let date of module.dates">
<strong>{{ date.label }}</strong> {{ date.timestamp * 1000 | coreFormatDate:'strftimedatetime' }} <strong>{{ date.label }}</strong> {{ date.timestamp * 1000 | coreFormatDate:'strftimedatetime' }}
</p> </p>
</div>
<!-- Module completion. -->
<core-course-module-completion *ngIf="module.completiondata && module.uservisible" [completion]="module.completiondata"
[moduleName]="module.name" [moduleId]="module.id" [showCompletionConditions]="true"
[showManualCompletion]="showManualCompletion" (completionChanged)="completionChanged.emit($event)">
</core-course-module-completion>
</ion-label> </ion-label>
</ion-item> </ion-item>
<ng-content></ng-content> <ng-content></ng-content>

View File

@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
import { CoreCourse } from '@features/course/services/course'; import { CoreCourse } from '@features/course/services/course';
import { CoreCourseModuleData, CoreCourseModuleCompletionData } from '@features/course/services/course-helper'; import { CoreCourseModuleData } from '@features/course/services/course-helper';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
@ -36,7 +36,6 @@ import { CoreSites } from '@services/sites';
export class CoreCourseModuleInfoComponent implements OnInit { export class CoreCourseModuleInfoComponent implements OnInit {
@Input() module!: CoreCourseModuleData; // The module to render. @Input() module!: CoreCourseModuleData; // The module to render.
@Input() showManualCompletion = true; // Whether to show manual completion, true by default.
@Input() courseId!: number; // The courseId the module belongs to. @Input() courseId!: number; // The courseId the module belongs to.
@Input() component!: string; // Component for format text directive. @Input() component!: string; // Component for format text directive.
@ -47,8 +46,6 @@ export class CoreCourseModuleInfoComponent implements OnInit {
@Input() hasDataToSync = false; // If the activity has any data to be synced. @Input() hasDataToSync = false; // If the activity has any data to be synced.
@Output() completionChanged = new EventEmitter<CoreCourseModuleCompletionData>(); // Notify when completion changes.
modicon = ''; modicon = '';
showCompletion = false; // Whether to show completion. showCompletion = false; // Whether to show completion.
moduleNameTranslated = ''; moduleNameTranslated = '';
@ -60,7 +57,6 @@ export class CoreCourseModuleInfoComponent implements OnInit {
this.modicon = await CoreCourseModuleDelegate.getModuleIconSrc(this.module.modname, this.module.modicon, this.module); this.modicon = await CoreCourseModuleDelegate.getModuleIconSrc(this.module.modname, this.module.modicon, this.module);
this.moduleNameTranslated = CoreCourse.translateModuleName(this.module.modname || ''); this.moduleNameTranslated = CoreCourse.translateModuleName(this.module.modname || '');
this.showCompletion = CoreSites.getRequiredCurrentSite().isVersionGreaterEqualThan('3.11'); this.showCompletion = CoreSites.getRequiredCurrentSite().isVersionGreaterEqualThan('3.11');
} }

View File

@ -6,6 +6,14 @@
<ion-icon name="fas-arrow-left" slot="icon-only" aria-hidden="true"></ion-icon> <ion-icon name="fas-arrow-left" slot="icon-only" aria-hidden="true"></ion-icon>
</ion-button> </ion-button>
</ion-col> </ion-col>
<ion-col *ngIf="showCompletion && (currentModule.completiondata &&
(currentModule.completiondata.isautomatic || showManualCompletion) && currentModule.uservisible)">
<!-- Module completion. -->
<core-course-module-completion [completion]="currentModule.completiondata" [moduleName]="currentModule.name"
[moduleId]="currentModule.id" [showCompletionConditions]="true" [showManualCompletion]="showManualCompletion"
(completionChanged)="completionChanged.emit($event)">
</core-course-module-completion>
</ion-col>
<ion-col size="auto"> <ion-col size="auto">
<ion-button fill="clear" class="core-course-next-module" *ngIf="nextModule" (click)="goToActivity(true)" <ion-button fill="clear" class="core-course-next-module" *ngIf="nextModule" (click)="goToActivity(true)"
[attr.aria-label]="'core.course.gotonextactivity' | translate"> [attr.aria-label]="'core.course.gotonextactivity' | translate">

View File

@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { Component, ElementRef, Input, OnDestroy, OnInit } from '@angular/core'; import { Component, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { CoreCourse, CoreCourseProvider, CoreCourseWSSection } from '@features/course/services/course'; import { CoreCourse, CoreCourseProvider, CoreCourseWSSection } from '@features/course/services/course';
import { CoreCourseModuleData } from '@features/course/services/course-helper'; import { CoreCourseModuleCompletionData, CoreCourseModuleData } from '@features/course/services/course-helper';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
import { IonContent } from '@ionic/angular'; import { IonContent } from '@ionic/angular';
import { ScrollDetail } from '@ionic/core'; import { ScrollDetail } from '@ionic/core';
@ -29,7 +29,7 @@ import { CoreMath } from '@singletons/math';
* Component to show a button to go to the next resource/activity. * Component to show a button to go to the next resource/activity.
* *
* Example usage: * Example usage:
* <core-course-module-navigation [courseId]="courseId" [currentModuleId]="module.id"></core-course-module-navigation> * <core-course-module-navigation [courseId]="courseId" [currentModule]="module"></core-course-module-navigation>
*/ */
@Component({ @Component({
selector: 'core-course-module-navigation', selector: 'core-course-module-navigation',
@ -39,13 +39,17 @@ import { CoreMath } from '@singletons/math';
export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy { export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy {
@Input() courseId!: number; // Course ID. @Input() courseId!: number; // Course ID.
@Input() currentModuleId!: number; // Current module ID. @Input() currentModule!: CoreCourseModuleData; // Current module.
@Input() showManualCompletion = true; // Whether to show manual completion, true by default.
@Output() completionChanged = new EventEmitter<CoreCourseModuleCompletionData>(); // Notify when completion changes.
nextModule?: CoreCourseModuleData; nextModule?: CoreCourseModuleData;
previousModule?: CoreCourseModuleData; previousModule?: CoreCourseModuleData;
nextModuleSection?: CoreCourseWSSection; nextModuleSection?: CoreCourseWSSection;
previousModuleSection?: CoreCourseWSSection; previousModuleSection?: CoreCourseWSSection;
loaded = false; loaded = false;
showCompletion = false; // Whether to show completion.
protected element: HTMLElement; protected element: HTMLElement;
protected initialHeight = 0; protected initialHeight = 0;
@ -78,6 +82,8 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy {
* @inheritdoc * @inheritdoc
*/ */
async ngOnInit(): Promise<void> { async ngOnInit(): Promise<void> {
this.showCompletion = CoreSites.getRequiredCurrentSite().isVersionGreaterEqualThan('3.11');
try { try {
await this.setNextAndPreviousModules(CoreSitesReadingStrategy.PREFER_CACHE); await this.setNextAndPreviousModules(CoreSitesReadingStrategy.PREFER_CACHE);
} finally { } finally {
@ -172,6 +178,7 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy {
} }
const preSets = CoreSites.getReadingStrategyPreSets(readingStrategy); const preSets = CoreSites.getReadingStrategyPreSets(readingStrategy);
const currentModuleId = this.currentModule.id;
const sections = await CoreCourse.getSections(this.courseId, false, true, preSets); const sections = await CoreCourse.getSections(this.courseId, false, true, preSets);
@ -184,7 +191,7 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy {
return false; return false;
} }
currentModuleIndex = section.modules.findIndex((module: CoreCourseModuleData) => module.id == this.currentModuleId); currentModuleIndex = section.modules.findIndex((module: CoreCourseModuleData) => module.id == currentModuleId);
return currentModuleIndex >= 0; return currentModuleIndex >= 0;
}); });

View File

@ -25,8 +25,7 @@
</ion-refresher> </ion-refresher>
<core-loading [hideUntil]="loaded"> <core-loading [hideUntil]="loaded">
<core-course-module-info [module]="module" [courseId]="courseId" [description]="module.description" [component]="module.modname" <core-course-module-info [module]="module" [courseId]="courseId" [description]="module.description" [component]="module.modname"
[componentId]="module.id" (completionChanged)="onCompletionChange()" [expandDescription]="true" [componentId]="module.id" [expandDescription]="true">
[showManualCompletion]="showManualCompletion">
<div class="safe-area-padding-horizontal ion-padding" *ngIf="module.handlerData?.extraBadge"> <div class="safe-area-padding-horizontal ion-padding" *ngIf="module.handlerData?.extraBadge">
<ion-badge class="ion-text-wrap ion-text-start" [color]="module.handlerData?.extraBadgeColor"> <ion-badge class="ion-text-wrap ion-text-start" [color]="module.handlerData?.extraBadgeColor">
@ -61,5 +60,6 @@
</core-course-module-info> </core-course-module-info>
</core-loading> </core-loading>
<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id"></core-course-module-navigation> <core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModule]="module"
(completionChanged)="onCompletionChange()" [showManualCompletion]="showManualCompletion"></core-course-module-navigation>
</ion-content> </ion-content>

View File

@ -30,4 +30,5 @@
(onLoadingContent)="contentLoading()"> (onLoadingContent)="contentLoading()">
</core-site-plugins-plugin-content> </core-site-plugins-plugin-content>
<core-course-module-navigation *ngIf="module" [courseId]="courseId" [currentModuleId]="module.id"></core-course-module-navigation> <core-course-module-navigation *ngIf="module" [courseId]="courseId" [currentModule]="module">
</core-course-module-navigation>