MOBILE-3810 module: Add data to sync to module info

main
Pau Ferrer Ocaña 2021-11-17 11:46:37 +01:00
parent f31fc5a6df
commit a0687821ae
16 changed files with 30 additions and 113 deletions

View File

@ -31,23 +31,13 @@
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description"
[component]="component" [componentId]="componentId" [courseId]="courseId"> [component]="component" [componentId]="componentId" [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>
</ion-list> </ion-list>
</core-course-module-info> </core-course-module-info>
<!-- Assign has something offline. -->
<ion-card class="core-warning-card" *ngIf="hasOffline">
<ion-item>
<ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>
<ion-label>{{ 'core.hasdatatosync' | translate: {$a: moduleName} }}</ion-label>
</ion-item>
</ion-card>
<!-- User can view all submissions (teacher). --> <!-- User can view all submissions (teacher). -->
<ng-container *ngIf="assign && canViewAllSubmissions"> <ng-container *ngIf="assign && canViewAllSubmissions">
<ion-list class="core-list-align-detail-right"> <ion-list class="core-list-align-detail-right">

View File

@ -30,7 +30,7 @@
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description"
[component]="component" [componentId]="componentId" [courseId]="courseId"> [component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline">
</core-course-module-info> </core-course-module-info>
<!-- Activity availability messages --> <!-- Activity availability messages -->
@ -58,14 +58,6 @@
</ion-item> </ion-item>
</ion-card> </ion-card>
<!-- Choice done in offline but not synchronized -->
<ion-card class="core-warning-card" *ngIf="hasOffline">
<ion-item>
<ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>
<ion-label>{{ 'core.hasdatatosync' | translate:{$a: moduleName} }}</ion-label>
</ion-item>
</ion-card>
<!-- Inform what will happen with the choices. --> <!-- Inform what will happen with the choices. -->
<ion-card class="core-info-card" *ngIf="canEdit && publishInfo && options.length"> <ion-card class="core-info-card" *ngIf="canEdit && publishInfo && options.length">
<ion-item> <ion-item>

View File

@ -40,17 +40,9 @@
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description"
[component]="component" [componentId]="componentId" [courseId]="courseId"> [component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings">
</core-course-module-info> </core-course-module-info>
<!-- Data done in offline but not synchronized -->
<ion-card class="core-warning-card" *ngIf="hasOffline || hasOfflineRatings">
<ion-item>
<ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>
<ion-label>{{ 'core.hasdatatosync' | translate: {$a: moduleName} }}</ion-label>
</ion-item>
</ion-card>
<ion-item class="ion-text-wrap" *ngIf="groupInfo && (groupInfo.separateGroups || groupInfo.visibleGroups)"> <ion-item class="ion-text-wrap" *ngIf="groupInfo && (groupInfo.separateGroups || groupInfo.visibleGroups)">
<ion-label id="addon-data-groupslabel"> <ion-label id="addon-data-groupslabel">
<ng-container *ngIf="groupInfo.separateGroups">{{'core.groupsseparate' | translate }}</ng-container> <ng-container *ngIf="groupInfo.separateGroups">{{'core.groupsseparate' | translate }}</ng-container>

View File

@ -30,7 +30,7 @@
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description"
[component]="component" [componentId]="componentId" [courseId]="courseId"> [component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline">
</core-course-module-info> </core-course-module-info>
<core-tabs [hideUntil]="tabsReady" [selectedIndex]="firstSelectedTab"> <core-tabs [hideUntil]="tabsReady" [selectedIndex]="firstSelectedTab">
@ -106,14 +106,6 @@
<core-loading [hideUntil]="tabsLoaded.overview"> <core-loading [hideUntil]="tabsLoaded.overview">
<ng-container *ngTemplateOutlet="basicInfo"></ng-container> <ng-container *ngTemplateOutlet="basicInfo"></ng-container>
<!-- Feedback done in offline but not synchronized -->
<ion-card class="core-warning-card" *ngIf="hasOffline">
<ion-item>
<ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>
<ion-label>{{ 'core.hasdatatosync' | translate:{$a: moduleName} }}</ion-label>
</ion-item>
</ion-card>
<ion-card class="core-info-card" *ngIf="access && access.cancomplete && !access.isopen"> <ion-card class="core-info-card" *ngIf="access && access.cancomplete && !access.isopen">
<ion-item> <ion-item>
<ion-icon name="fas-question-circle" slot="start" aria-hidden="true"></ion-icon> <ion-icon name="fas-question-circle" slot="start" aria-hidden="true"></ion-icon>

View File

@ -39,8 +39,8 @@
<core-loading [hideUntil]="discussions.loaded"> <core-loading [hideUntil]="discussions.loaded">
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" <core-course-module-info [module]="module" (completionChanged)="onCompletionChange()"
[description]="forum && forum.type != 'single' && description" [component]="component" [description]="forum && forum.type != 'single' && description" [component]="component" [componentId]="componentId"
[componentId]="componentId" [courseId]="courseId"> [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings">
<ion-item> <ion-item>
<ion-label> <ion-label>
{{descriptionNote}} {{descriptionNote}}
@ -48,14 +48,6 @@
</ion-item> </ion-item>
</core-course-module-info> </core-course-module-info>
<!-- Forum discussions found to be synchronized -->
<ion-card class="core-warning-card" *ngIf="hasOffline || hasOfflineRatings">
<ion-item>
<ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>
<ion-label>{{ 'core.hasdatatosync' | translate:{$a: moduleName} }}</ion-label>
</ion-item>
</ion-card>
<!-- Cut-off date or due date message --> <!-- Cut-off date or due date message -->
<ion-card class="core-info-card" *ngIf="availabilityMessage"> <ion-card class="core-info-card" *ngIf="availabilityMessage">
<ion-item> <ion-item>

View File

@ -51,17 +51,9 @@
<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" (completionChanged)="onCompletionChange()" [description]="description"
[component]="component" [componentId]="componentId" [courseId]="courseId"> [component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings">
</core-course-module-info> </core-course-module-info>
<!-- Has offline data to be synchronized -->
<ion-card class="core-warning-card" *ngIf="hasOffline || hasOfflineRatings">
<ion-item>
<ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>
<ion-label>{{ 'core.hasdatatosync' | translate:{$a: moduleName} }}</ion-label>
</ion-item>
</ion-card>
<ion-list *ngIf="!isSearch && entries.offlineEntries.length > 0"> <ion-list *ngIf="!isSearch && entries.offlineEntries.length > 0">
<ion-item-divider> <ion-item-divider>
<ion-label> <ion-label>

View File

@ -37,17 +37,9 @@
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description"
[component]="component" [componentId]="componentId" [courseId]="courseId"> [component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline">
</core-course-module-info> </core-course-module-info>
<!-- Offline data stored. -->
<ion-card class="core-warning-card" *ngIf="hasOffline">
<ion-item>
<ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>
<ion-label>{{ 'core.hasdatatosync' | translate: {$a: moduleName} }}</ion-label>
</ion-item>
</ion-card>
<!-- Offline disabled. --> <!-- Offline disabled. -->
<ion-card class="core-warning-card" *ngIf="!siteCanDownload && playing"> <ion-card class="core-warning-card" *ngIf="!siteCanDownload && playing">
<ion-item> <ion-item>

View File

@ -34,7 +34,7 @@
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description"
[component]="component" [componentId]="componentId" [courseId]="courseId"> [component]="component" [componentId]="componentId" [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. -->
@ -45,14 +45,6 @@
</ion-item> </ion-item>
</ion-card> </ion-card>
<!-- Lesson has data to be synchronized -->
<ion-card class="core-warning-card" *ngIf="hasOffline">
<ion-item>
<ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>
<ion-label>{{ 'core.hasdatatosync' | translate: {$a: moduleName} }}</ion-label>
</ion-item>
</ion-card>
<!-- Input password for protected lessons. --> <!-- Input password for protected lessons. -->
<ion-card *ngIf="askPassword"> <ion-card *ngIf="askPassword">
<form (ngSubmit)="submitPassword($event, passwordinput)" #passwordForm> <form (ngSubmit)="submitPassword($event, passwordinput)" #passwordForm>

View File

@ -30,7 +30,8 @@
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description"
[component]="component" [componentId]="componentId" [courseId]="courseId"> [component]="component" [componentId]="componentId" [courseId]="courseId"
[hasDataToSync]="buttonText && hasOffline && !showStatusSpinner">
</core-course-module-info> </core-course-module-info>
<!-- Access rules description messages. --> <!-- Access rules description messages. -->
@ -194,14 +195,6 @@
</ion-label> </ion-label>
</ion-item> </ion-item>
<!-- Quiz has data to be synchronized -->
<ion-card class="core-warning-card" *ngIf="buttonText && hasOffline && !showStatusSpinner">
<ion-item class="ion-text-wrap">
<ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>
<ion-label>{{ 'core.hasdatatosync' | translate: {$a: moduleName} }}</ion-label>
</ion-item>
</ion-card>
<!-- Other warnings. --> <!-- Other warnings. -->
<ion-item class="core-warning-item ion-text-wrap" *ngIf="hasSupportedQuestions && unsupportedQuestions.length"> <ion-item class="core-warning-item ion-text-wrap" *ngIf="hasSupportedQuestions && unsupportedQuestions.length">
<ion-label> <ion-label>

View File

@ -30,7 +30,7 @@
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description" <core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description"
[component]="component" [componentId]="componentId" [courseId]="courseId"> [component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="!errorMessage && hasOffline">
</core-course-module-info> </core-course-module-info>
<!-- Warning message. --> <!-- Warning message. -->
@ -113,14 +113,6 @@
</ion-list> </ion-list>
</ion-card> </ion-card>
<!-- Synchronization warning. -->
<ion-card class="core-warning-card" *ngIf="!errorMessage && hasOffline">
<ion-item>
<ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>
<ion-label>{{ 'core.hasdatatosync' | translate: {$a: moduleName} }}</ion-label>
</ion-item>
</ion-card>
<!-- TOC. --> <!-- TOC. -->
<ion-card *ngIf="scorm && organizations && !skip && <ion-card *ngIf="scorm && organizations && !skip &&
((scorm.displaycoursestructure && organizations.length) || organizations.length > 1)" class="addon-mod_scorm-toc"> ((scorm.displaycoursestructure && organizations.length) || organizations.length > 1)" class="addon-mod_scorm-toc">

View File

@ -31,8 +31,8 @@
<!-- Activity info. --> <!-- Activity info. -->
<core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" <core-course-module-info [module]="module" (completionChanged)="onCompletionChange()"
[description]="survey && !survey.surveydone && !hasOffline && description" [component]="component" [description]="survey && !survey.surveydone && !hasOffline && description" [component]="component" [componentId]="componentId"
[componentId]="componentId" [courseId]="courseId"> [courseId]="courseId" [hasDataToSync]="hasOffline">
</core-course-module-info> </core-course-module-info>
<!-- Survey already done --> <!-- Survey already done -->
@ -44,14 +44,6 @@
</ion-button> </ion-button>
</ion-card> </ion-card>
<!-- Survey done in offline but not synchronized -->
<ion-card class="core-warning-card" *ngIf="hasOffline">
<ion-item>
<ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>
<ion-label>{{ 'core.hasdatatosync' | translate: {$a: moduleName} }}</ion-label>
</ion-item>
</ion-card>
<!-- Survey questions --> <!-- Survey questions -->
<form *ngIf="survey && !survey.surveydone && !hasOffline && questions && questions.length"> <form *ngIf="survey && !survey.surveydone && !hasOffline && questions && questions.length">

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()"> <core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [hasDataToSync]="hasOffline">
</core-course-module-info> </core-course-module-info>
<ion-card *ngIf="phases"> <ion-card *ngIf="phases">
@ -60,14 +60,6 @@
</ng-container> </ng-container>
</ion-card> </ion-card>
<!-- Has something offline. -->
<ion-card class="core-warning-card" *ngIf="hasOffline">
<ion-item>
<ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>
<ion-label>{{ 'core.hasdatatosync' | translate: {$a: moduleName} }}</ion-label>
</ion-item>
</ion-card>
<!-- Description (setup phase only) --> <!-- Description (setup phase only) -->
<ion-card *ngIf="description && workshop && workshop!.phase == PHASE_SETUP"> <ion-card *ngIf="description && workshop && workshop!.phase == PHASE_SETUP">
<ion-item class="ion-text-wrap"> <ion-item class="ion-text-wrap">

View File

@ -35,3 +35,11 @@
</ion-label> </ion-label>
</ion-item> </ion-item>
<ng-content></ng-content> <ng-content></ng-content>
<!-- Activity has something offline. -->
<ion-card class="core-warning-card" *ngIf="hasDataToSync">
<ion-item>
<ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>
<ion-label>{{ 'core.hasdatatosync' | translate: {$a: moduleNameTranslated} }}</ion-label>
</ion-item>
</ion-card>

View File

@ -4,6 +4,7 @@
display: block; display: block;
box-shadow: 0px 3px 3px rgba(var(--drop-shadow)); box-shadow: 0px 3px 3px rgba(var(--drop-shadow));
margin-bottom: 8px; margin-bottom: 8px;
padding-bottom: 1px; // To allow margins inside.
background-color: var(--contrast-background); background-color: var(--contrast-background);
@include padding-horizontal(var(--ion-safe-area-left), var(--ion-safe-area-right)); @include padding-horizontal(var(--ion-safe-area-left), var(--ion-safe-area-right));

View File

@ -13,6 +13,7 @@
// limitations under the License. // limitations under the License.
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { CoreCourse } from '@features/course/services/course';
import { CoreCourseModule, CoreCourseModuleCompletionData } from '@features/course/services/course-helper'; import { CoreCourseModule, CoreCourseModuleCompletionData } 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';
@ -42,10 +43,13 @@ export class CoreCourseModuleInfoComponent implements OnInit {
@Input() description?: string | false; // The description to display. If false, no description will be shown. @Input() description?: string | false; // The description to display. If false, no description will be shown.
@Input() hasDataToSync = false; // If the activity has any data to be synced.
@Output() completionChanged = new EventEmitter<CoreCourseModuleCompletionData>(); // Notify when completion changes. @Output() completionChanged = new EventEmitter<CoreCourseModuleCompletionData>(); // Notify when completion changes.
modicon = ''; modicon = '';
showCompletion = false; // Whether to show completion. showCompletion = false; // Whether to show completion.
moduleNameTranslated = '';
/** /**
* @inheritdoc * @inheritdoc
@ -53,6 +57,8 @@ export class CoreCourseModuleInfoComponent implements OnInit {
async ngOnInit(): Promise<void> { async ngOnInit(): Promise<void> {
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.showCompletion = CoreSites.getRequiredCurrentSite().isVersionGreaterEqualThan('3.11'); this.showCompletion = CoreSites.getRequiredCurrentSite().isVersionGreaterEqualThan('3.11');
} }

View File

@ -109,7 +109,6 @@ export class CoreCoursesDashboardPage implements OnInit, OnDestroy {
this.blocks = []; this.blocks = [];
} }
// this.dashboardEnabled = this.blockDelegate.hasSupportedBlock(this.blocks);
this.loaded = true; this.loaded = true;
} }