MOBILE-2661 course: Don't display hidden warnings if not needed

main
dpalou 2018-10-08 13:18:40 +02:00
parent 3e12557451
commit 2135cdee7b
4 changed files with 6 additions and 5 deletions

View File

@ -82,7 +82,7 @@
</ion-item> </ion-item>
<ng-container *ngFor="let module of section.modules"> <ng-container *ngFor="let module of section.modules">
<core-course-module *ngIf="module.visibleoncoursepage !== 0" [module]="module" [courseId]="course.id" [downloadEnabled]="downloadEnabled" (completionChanged)="completionChanged.emit()"></core-course-module> <core-course-module *ngIf="module.visibleoncoursepage !== 0" [module]="module" [courseId]="course.id" [downloadEnabled]="downloadEnabled" [section]="section" (completionChanged)="completionChanged.emit()"></core-course-module>
</ng-container> </ng-container>
</section> </section>
</ng-template> </ng-template>

View File

@ -30,11 +30,11 @@
</div> </div>
</div> </div>
</div> </div>
<div *ngIf="module.visible === 0 || module.availabilityinfo || module.handlerData.extraBadge || module.isStealth || (module.completionstatus && module.completionstatus.offline)"> <div>
<ion-badge item-end *ngIf="module.handlerData.extraBadge" [color]="module.handlerData.extraBadgeColor" text-wrap text-start> <ion-badge item-end *ngIf="module.handlerData.extraBadge" [color]="module.handlerData.extraBadgeColor" text-wrap text-start>
<core-format-text [text]="module.handlerData.extraBadge"></core-format-text> <core-format-text [text]="module.handlerData.extraBadge"></core-format-text>
</ion-badge> </ion-badge>
<ion-badge item-end *ngIf="module.visible === 0" text-wrap>{{ 'core.course.hiddenfromstudents' | translate }}</ion-badge> <ion-badge item-end *ngIf="module.visible === 0 && (!section || section.visible)" text-wrap>{{ 'core.course.hiddenfromstudents' | translate }}</ion-badge>
<ion-badge item-end *ngIf="module.visible !== 0 && module.isStealth" text-wrap>{{ 'core.course.hiddenoncoursepage' | translate }}</ion-badge> <ion-badge item-end *ngIf="module.visible !== 0 && module.isStealth" text-wrap>{{ 'core.course.hiddenoncoursepage' | translate }}</ion-badge>
<ion-badge item-end *ngIf="module.availabilityinfo" text-wrap><core-format-text [text]="module.availabilityinfo"></core-format-text></ion-badge> <ion-badge item-end *ngIf="module.availabilityinfo" text-wrap><core-format-text [text]="module.availabilityinfo"></core-format-text></ion-badge>
<ion-badge item-end *ngIf="module.completionstatus && module.completionstatus.offline" color="warning" text-wrap>{{ 'core.course.manualcompletionnotsynced' | translate }}</ion-badge> <ion-badge item-end *ngIf="module.completionstatus && module.completionstatus.offline" color="warning" text-wrap>{{ 'core.course.manualcompletionnotsynced' | translate }}</ion-badge>

View File

@ -36,6 +36,7 @@ import { CoreConstants } from '../../../constants';
export class CoreCourseModuleComponent implements OnInit, OnDestroy { export class CoreCourseModuleComponent implements OnInit, OnDestroy {
@Input() module: any; // The module to render. @Input() module: any; // The module to render.
@Input() courseId: number; // The course the module belongs to. @Input() courseId: number; // The course the module belongs to.
@Input() section: any; // The section the module belongs to.
@Input('downloadEnabled') set enabled(value: boolean) { @Input('downloadEnabled') set enabled(value: boolean) {
this.downloadEnabled = value; this.downloadEnabled = value;

View File

@ -7,7 +7,7 @@
<core-format-text [text]="section.summary"></core-format-text> <core-format-text [text]="section.summary"></core-format-text>
</ion-item> </ion-item>
<core-course-module *ngFor="let module of section.modules" [module]="module" [courseId]="siteHomeId" [downloadEnabled]="true"></core-course-module> <core-course-module *ngFor="let module of section.modules" [module]="module" [courseId]="siteHomeId" [downloadEnabled]="true" [section]="section"></core-course-module>
</ng-container> </ng-container>
<!-- Site home items: news, categories, courses, etc. --> <!-- Site home items: news, categories, courses, etc. -->
@ -29,7 +29,7 @@
<core-format-text [text]="block.summary"></core-format-text> <core-format-text [text]="block.summary"></core-format-text>
</ion-item> </ion-item>
<core-course-module *ngFor="let module of block.modules" [module]="module" [courseId]="siteHomeId" [downloadEnabled]="true"></core-course-module> <core-course-module *ngFor="let module of block.modules" [module]="module" [courseId]="siteHomeId" [downloadEnabled]="true" [section]="block"></core-course-module>
</ng-container> </ng-container>
</ion-list> </ion-list>