MOBILE-3814 completion: Move manual completion button to module info
parent
df1f910ee2
commit
bde07cb125
|
@ -10,7 +10,7 @@
|
|||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||
[courseId]="courseId" [hasDataToSync]="hasOffline">
|
||||
[courseId]="courseId" [hasDataToSync]="hasOffline" (completionChanged)="onCompletionChange()">
|
||||
<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>
|
||||
|
@ -127,6 +127,5 @@
|
|||
</addon-mod-assign-submission>
|
||||
</core-loading>
|
||||
|
||||
<core-course-module-navigation collapsible-footer [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
|
||||
(completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation collapsible-footer [hidden]="showLoading" [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||
[courseId]="courseId">
|
||||
[courseId]="courseId" (completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<ng-container *ngIf="groupInfo && (groupInfo.separateGroups || groupInfo.visibleGroups)">
|
||||
|
@ -114,7 +114,7 @@
|
|||
</ion-button>
|
||||
</div>
|
||||
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
</div>
|
||||
</core-loading>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||
[courseId]="courseId">
|
||||
[courseId]="courseId" (completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<ion-list>
|
||||
|
@ -41,7 +41,7 @@
|
|||
</ion-button>
|
||||
</div>
|
||||
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
</div>
|
||||
</core-loading>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||
[courseId]="courseId">
|
||||
[courseId]="courseId" (completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<ion-card *ngIf="chatInfo" class="core-info-card">
|
||||
|
@ -31,7 +31,7 @@
|
|||
</ion-button>
|
||||
</div>
|
||||
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
</div>
|
||||
</core-loading>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<div class="list-item-limited-width">
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||
[courseId]="courseId" [hasDataToSync]="hasOffline">
|
||||
[courseId]="courseId" [hasDataToSync]="hasOffline" (completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<!-- Activity availability messages -->
|
||||
|
@ -146,7 +146,7 @@
|
|||
</ion-button>
|
||||
</div>
|
||||
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
</div>
|
||||
</core-loading>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||
[courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings">
|
||||
[courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings" (completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<ion-item class="ion-text-wrap core-group-selector" *ngIf="groupInfo && (groupInfo.separateGroups || groupInfo.visibleGroups)">
|
||||
|
@ -120,8 +120,7 @@
|
|||
|
||||
</core-loading>
|
||||
|
||||
<core-course-module-navigation collapsible-footer [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
|
||||
(completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation collapsible-footer [hidden]="showLoading" [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
|
||||
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="canAdd">
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||
[courseId]="courseId" [hasDataToSync]="hasOffline">
|
||||
[courseId]="courseId" [hasDataToSync]="hasOffline" (completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<core-tabs [hideUntil]="tabsReady" [selectedIndex]="firstSelectedTab">
|
||||
|
@ -52,7 +52,7 @@
|
|||
</ion-button>
|
||||
</div>
|
||||
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
</div>
|
||||
</core-loading>
|
||||
|
|
|
@ -32,6 +32,6 @@
|
|||
|
||||
</core-loading>
|
||||
|
||||
<core-course-module-navigation collapsible-footer [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
|
||||
<core-course-module-navigation collapsible-footer [hidden]="showLoading" [courseId]="courseId" [currentModuleId]="module.id"
|
||||
(completionChanged)="onCompletionChange()">
|
||||
</core-course-module-navigation>
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
<core-loading [hideUntil]="!showLoading && discussions && discussions.loaded">
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="forum && forum.type != 'single' && description" [component]="component"
|
||||
[componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings">
|
||||
[componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings"
|
||||
(completionChanged)="onCompletionChange()">
|
||||
<ion-item class="ion-text-wrap">
|
||||
<ion-label>
|
||||
{{descriptionNote}}
|
||||
|
@ -114,8 +115,7 @@
|
|||
</ng-container>
|
||||
</core-loading>
|
||||
|
||||
<core-course-module-navigation collapsible-footer [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
|
||||
(completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation collapsible-footer [hidden]="showLoading" [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
|
||||
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="forum && canAddDiscussion">
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
<core-loading [hideUntil]="!showLoading">
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info *ngIf="!isSearch" [module]="module" [description]="description" [component]="component"
|
||||
[componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings">
|
||||
[componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings"
|
||||
(completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<ion-list *ngIf="!isSearch && entries && entries.offlineEntries.length > 0">
|
||||
|
@ -72,8 +73,7 @@
|
|||
</core-infinite-loading>
|
||||
</core-loading>
|
||||
|
||||
<core-course-module-navigation collapsible-footer [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
|
||||
(completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation collapsible-footer [hidden]="showLoading" [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
|
||||
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="canAdd">
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||
[courseId]="courseId" [hasDataToSync]="hasOffline">
|
||||
[courseId]="courseId" [hasDataToSync]="hasOffline" (completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<!-- Offline disabled. -->
|
||||
|
@ -68,6 +68,5 @@
|
|||
</core-h5p-iframe>
|
||||
</core-loading>
|
||||
|
||||
<core-course-module-navigation collapsible-footer [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
|
||||
(completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation collapsible-footer [hidden]="showLoading" [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||
[courseId]="courseId">
|
||||
[courseId]="courseId" (completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<ion-list>
|
||||
|
@ -38,7 +38,7 @@
|
|||
</ion-button>
|
||||
</div>
|
||||
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
</div>
|
||||
</core-loading>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||
[courseId]="courseId" [hasDataToSync]="hasOffline">
|
||||
[courseId]="courseId" [hasDataToSync]="hasOffline" (completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<!-- Prevent access messages. Only show the first one. -->
|
||||
|
@ -214,7 +214,7 @@
|
|||
<ng-container *ngTemplateOutlet="buttons"></ng-container>
|
||||
</div>
|
||||
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
</div>
|
||||
</core-loading>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="displayDescription && description" [component]="component"
|
||||
[componentId]="componentId" [courseId]="courseId">
|
||||
[componentId]="componentId" [courseId]="courseId" (completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<div collapsible-footer *ngIf="!showLoading" slot="fixed">
|
||||
|
@ -21,7 +21,7 @@
|
|||
</ion-button>
|
||||
</div>
|
||||
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
</div>
|
||||
</core-loading>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="displayDescription && description" [component]="component"
|
||||
[componentId]="componentId" [courseId]="courseId">
|
||||
[componentId]="componentId" [courseId]="courseId" (completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<ion-card class="core-warning-card" *ngIf="warning">
|
||||
|
@ -32,6 +32,5 @@
|
|||
|
||||
</core-loading>
|
||||
|
||||
<core-course-module-navigation collapsible-footer [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
|
||||
(completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation collapsible-footer [hidden]="showLoading" [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||
[courseId]="courseId" [hasDataToSync]="buttonText && hasOffline">
|
||||
[courseId]="courseId" [hasDataToSync]="buttonText && hasOffline" (completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<!-- Access rules description messages. -->
|
||||
|
@ -213,7 +213,7 @@
|
|||
</ion-button>
|
||||
</div>
|
||||
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [courseId]="courseId" [description]="displayDescription && description"
|
||||
[component]="component" [componentId]="componentId">
|
||||
[component]="component" [componentId]="componentId" (completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<ion-card class="core-warning-card" *ngIf="warning">
|
||||
|
@ -98,7 +98,7 @@
|
|||
{{ 'core.openwith' | translate }}
|
||||
</ion-button>
|
||||
</div>
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
</div>
|
||||
</core-loading>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||
[courseId]="courseId" [hasDataToSync]="!errorMessage && hasOffline">
|
||||
[courseId]="courseId" [hasDataToSync]="!errorMessage && hasOffline" (completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<!-- Warning message. -->
|
||||
|
@ -221,7 +221,7 @@
|
|||
</ion-item>
|
||||
</ng-container>
|
||||
</div>
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
</div>
|
||||
</core-loading>
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="survey && !survey.surveydone && !hasOffline && description"
|
||||
[component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline">
|
||||
[component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline"
|
||||
(completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<!-- Survey already done -->
|
||||
|
@ -130,7 +131,7 @@
|
|||
</ion-button>
|
||||
</div>
|
||||
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
</div>
|
||||
</core-loading>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="displayDescription && description" [component]="component"
|
||||
[componentId]="componentId" [courseId]="courseId">
|
||||
[componentId]="componentId" [courseId]="courseId" (completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<div *ngIf="shouldIframe || (shouldEmbed && isOther)" class="addon-mod_url-embedded-url">
|
||||
|
@ -44,7 +44,7 @@
|
|||
{{ 'addon.mod_url.accessurl' | translate }}
|
||||
</ion-button>
|
||||
</div>
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
</div>
|
||||
</core-loading>
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
|
||||
[courseId]="courseId">
|
||||
[courseId]="courseId" (completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<div *ngIf="pageIsOffline || hasOffline || pageWarning">
|
||||
|
@ -71,8 +71,7 @@
|
|||
</div>
|
||||
</core-loading>
|
||||
|
||||
<core-course-module-navigation collapsible-footer [hidden]="showLoading" [courseId]="courseId" [currentModule]="module"
|
||||
(completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation collapsible-footer [hidden]="showLoading" [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
|
||||
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="canEdit">
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<core-loading [hideUntil]="!showLoading" class="list-item-limited-width">
|
||||
|
||||
<!-- Activity info. -->
|
||||
<core-course-module-info [module]="module" [hasDataToSync]="hasOffline">
|
||||
<core-course-module-info [module]="module" [hasDataToSync]="hasOffline" (completionChanged)="onCompletionChange()">
|
||||
</core-course-module-info>
|
||||
|
||||
<ion-card *ngIf="phases">
|
||||
|
@ -235,7 +235,7 @@
|
|||
</ion-button>
|
||||
</div>
|
||||
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
|
||||
<core-course-module-navigation [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
</div>
|
||||
</core-loading>
|
||||
|
|
|
@ -23,10 +23,12 @@
|
|||
<ng-content select="[description]"></ng-content>
|
||||
|
||||
<!-- Module completion. -->
|
||||
<ion-item class="ion-text-wrap" *ngIf="showCompletion && module.completiondata && module.completiondata.isautomatic">
|
||||
<ion-item class="ion-text-wrap"
|
||||
*ngIf="showCompletion && module.completiondata && (module.completiondata.isautomatic || (showManualCompletion && module.uservisible))">
|
||||
<ion-label>
|
||||
<core-course-module-completion [completion]="module.completiondata" [moduleName]="module.name" [moduleId]="module.id"
|
||||
[showCompletionConditions]="true">
|
||||
[showCompletionConditions]="true" [showManualCompletion]="showManualCompletion && module.uservisible"
|
||||
(completionChanged)="completionChanged.emit($event)">
|
||||
</core-course-module-completion>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { CoreCourse } 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 { CoreSites } from '@services/sites';
|
||||
|
||||
|
@ -48,6 +48,9 @@ export class CoreCourseModuleInfoComponent implements OnInit {
|
|||
|
||||
@Input() hasDataToSync = false; // If the activity has any data to be synced.
|
||||
|
||||
@Input() showManualCompletion = true; // Whether to show manual completion, true by default.
|
||||
@Output() completionChanged = new EventEmitter<CoreCourseModuleCompletionData>(); // Notify when completion changes.
|
||||
|
||||
modicon = '';
|
||||
showCompletion = false; // Whether to show completion.
|
||||
moduleNameTranslated = '';
|
||||
|
|
|
@ -6,13 +6,6 @@
|
|||
<ion-icon name="fas-arrow-left" slot="icon-only" aria-hidden="true"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-col>
|
||||
<ion-col class="ion-no-padding"
|
||||
*ngIf="showCompletion && (currentModule.completiondata && showManualCompletion && currentModule.uservisible)">
|
||||
<!-- Module completion. -->
|
||||
<core-course-module-completion [completion]="currentModule.completiondata" [moduleName]="currentModule.name"
|
||||
[moduleId]="currentModule.id" [showManualCompletion]="true" (completionChanged)="completionChanged.emit($event)">
|
||||
</core-course-module-completion>
|
||||
</ion-col>
|
||||
<ion-col size="auto" class="ion-no-padding core-course-module-navigation-arrow">
|
||||
<ion-button fill="clear" class="core-course-next-module" [disabled]="!nextModule" (click)="goToActivity(true)"
|
||||
[attr.aria-label]="'core.course.gotonextactivity' | translate">
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { Component, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
|
||||
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
import { CoreCourse, CoreCourseProvider, CoreCourseWSSection } from '@features/course/services/course';
|
||||
import { CoreCourseModuleCompletionData, CoreCourseModuleData } from '@features/course/services/course-helper';
|
||||
import { CoreCourseModuleData } from '@features/course/services/course-helper';
|
||||
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
|
||||
import { IonContent } from '@ionic/angular';
|
||||
import { CoreNavigationOptions, CoreNavigator } from '@services/navigator';
|
||||
|
@ -27,7 +27,7 @@ import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
|||
* Component to show a button to go to the next resource/activity.
|
||||
*
|
||||
* Example usage:
|
||||
* <core-course-module-navigation [courseId]="courseId" [currentModule]="module"></core-course-module-navigation>
|
||||
* <core-course-module-navigation [courseId]="courseId" [currentModuleId]="moduleId"></core-course-module-navigation>
|
||||
*/
|
||||
@Component({
|
||||
selector: 'core-course-module-navigation',
|
||||
|
@ -37,21 +37,17 @@ import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
|||
export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy {
|
||||
|
||||
@Input() courseId!: number; // Course 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.
|
||||
@Input() currentModuleId!: number; // Current module Id.
|
||||
|
||||
nextModule?: CoreCourseModuleData;
|
||||
previousModule?: CoreCourseModuleData;
|
||||
nextModuleSection?: CoreCourseWSSection;
|
||||
previousModuleSection?: CoreCourseWSSection;
|
||||
loaded = false;
|
||||
showCompletion = false; // Whether to show completion.
|
||||
|
||||
protected completionObserver: CoreEventObserver;
|
||||
|
||||
constructor(el: ElementRef, protected ionContent: IonContent) {
|
||||
constructor(protected ionContent: IonContent) {
|
||||
const siteId = CoreSites.getCurrentSiteId();
|
||||
|
||||
this.completionObserver = CoreEvents.on(CoreEvents.COMPLETION_MODULE_VIEWED, async (data) => {
|
||||
|
@ -70,8 +66,6 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy {
|
|||
* @inheritdoc
|
||||
*/
|
||||
async ngOnInit(): Promise<void> {
|
||||
this.showCompletion = CoreSites.getRequiredCurrentSite().isVersionGreaterEqualThan('3.11');
|
||||
|
||||
try {
|
||||
await this.setNextAndPreviousModules(CoreSitesReadingStrategy.PREFER_CACHE);
|
||||
} finally {
|
||||
|
@ -104,7 +98,6 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
const preSets = CoreSites.getReadingStrategyPreSets(readingStrategy);
|
||||
const currentModuleId = this.currentModule.id;
|
||||
|
||||
const sections = await CoreCourse.getSections(this.courseId, false, true, preSets);
|
||||
|
||||
|
@ -117,7 +110,7 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy {
|
|||
return false;
|
||||
}
|
||||
|
||||
currentModuleIndex = section.modules.findIndex((module: CoreCourseModuleData) => module.id == currentModuleId);
|
||||
currentModuleIndex = section.modules.findIndex((module: CoreCourseModuleData) => module.id == this.currentModuleId);
|
||||
|
||||
return currentModuleIndex >= 0;
|
||||
});
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
</ion-refresher>
|
||||
<core-loading [hideUntil]="loaded" class="has-spacer list-item-limited-width">
|
||||
<core-course-module-info [module]="module" [courseId]="courseId" [description]="module.description" [component]="module.modname"
|
||||
[componentId]="module.id" [expandDescription]="true" [showAvailabilityInfo]="true">
|
||||
[componentId]="module.id" [expandDescription]="true" [showAvailabilityInfo]="true" (completionChanged)="onCompletionChange()"
|
||||
[showManualCompletion]="showManualCompletion">
|
||||
<div class="core-module-additional-info" title>
|
||||
<ion-chip *ngIf="module.handlerData?.extraBadge" [color]="module.handlerData?.extraBadgeColor"
|
||||
class="ion-text-wrap ion-text-start" [outline]="true">
|
||||
|
@ -44,6 +45,6 @@
|
|||
<core-course-unsupported-module *ngIf="unsupported" [module]="module"></core-course-unsupported-module>
|
||||
</core-loading>
|
||||
|
||||
<core-course-module-navigation collapsible-footer [hidden]="!loaded" [courseId]="courseId" [currentModule]="module"
|
||||
(completionChanged)="onCompletionChange()" [showManualCompletion]="showManualCompletion"></core-course-module-navigation>
|
||||
<core-course-module-navigation collapsible-footer [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
</ion-content>
|
||||
|
|
|
@ -14,5 +14,5 @@
|
|||
(onLoadingContent)="contentLoading()">
|
||||
</core-site-plugins-plugin-content>
|
||||
|
||||
<core-course-module-navigation collapsible-footer *ngIf="module" [courseId]="courseId" [currentModule]="module">
|
||||
<core-course-module-navigation collapsible-footer *ngIf="module" [courseId]="courseId" [currentModuleId]="module.id">
|
||||
</core-course-module-navigation>
|
||||
|
|
Loading…
Reference in New Issue