MOBILE-3814 course: Add hidden sections to course index

main
Pau Ferrer Ocaña 2022-03-15 12:27:25 +01:00
parent d6051f0e70
commit 2bf21e3468
2 changed files with 11 additions and 4 deletions

View File

@ -24,7 +24,7 @@
</ion-item> </ion-item>
<ng-container *ngIf="allSectionId != section.id"> <ng-container *ngIf="allSectionId != section.id">
<ion-item class="divider section" (click)="selectSectionOrModule($event, section.id)" button <ion-item class="divider section" (click)="selectSectionOrModule($event, section.id)" button
[class.item-current]="selectedId === section.id" [class.item-dimmed]="section.visible === 0" [class.item-current]="selectedId === section.id" [class.item-dimmed]="!section.visible"
[class.item-hightlighted]="section.highlighted" detail="false" sticky="true"> [class.item-hightlighted]="section.highlighted" detail="false" sticky="true">
<ion-icon *ngIf="section.hasVisibleModules" name="fas-chevron-right" flip-rtl slot="start" <ion-icon *ngIf="section.hasVisibleModules" name="fas-chevron-right" flip-rtl slot="start"
class="expandable-status-icon" (click)="toggleExpand($event, section)" class="expandable-status-icon" (click)="toggleExpand($event, section)"
@ -40,9 +40,13 @@
</core-format-text> </core-format-text>
</h2> </h2>
</ion-label> </ion-label>
<ion-badge *ngIf="section.highlighted && highlighted">{{highlighted}}</ion-badge> <ion-badge *ngIf="section.highlighted && highlighted" slot="end">{{highlighted}}</ion-badge>
<ion-icon name="fas-lock" *ngIf="section.availabilityinfo" slot="end" class="restricted" <ion-icon name="fas-lock" *ngIf="section.availabilityinfo" slot="end" class="restricted"
[attr.aria-label]="'core.restricted' | translate"></ion-icon> [attr.aria-label]="'core.restricted' | translate"></ion-icon>
<ion-icon name="fas-eye-slash" *ngIf="!section.visible && !section.uservisible" slot="end" class="restricted"
[attr.aria-label]="'core.notavailable' | translate"></ion-icon>
<ion-icon name="fas-eye-slash" *ngIf="!section.visible && section.uservisible" slot="end" class="restricted"
[attr.aria-label]="'core.course.hiddenfromstudents' | translate"></ion-icon>
</ion-item> </ion-item>
<ng-container *ngIf="section.expanded"> <ng-container *ngIf="section.expanded">
<ng-container *ngFor="let module of section.modules"> <ng-container *ngFor="let module of section.modules">

View File

@ -78,8 +78,7 @@ export class CoreCourseCourseIndexComponent implements OnInit {
// Clone sections to add information. // Clone sections to add information.
this.sectionsToRender = this.sections this.sectionsToRender = this.sections
.filter((section) => !section.hiddenbynumsections && .filter((section) => !section.hiddenbynumsections &&
section.id != CoreCourseProvider.STEALTH_MODULES_SECTION_ID && section.id != CoreCourseProvider.STEALTH_MODULES_SECTION_ID)
section.uservisible !== false)
.map((section) => { .map((section) => {
const modules = section.modules const modules = section.modules
.filter((module) => module.visibleoncoursepage !== 0 && !module.noviewlink) .filter((module) => module.visibleoncoursepage !== 0 && !module.noviewlink)
@ -103,6 +102,8 @@ export class CoreCourseCourseIndexComponent implements OnInit {
id: section.id, id: section.id,
name: section.name, name: section.name,
availabilityinfo: !!section.availabilityinfo, availabilityinfo: !!section.availabilityinfo,
visible: !!section.visible,
uservisible: section.uservisible !== false,
expanded: section.id === this.selectedId, expanded: section.id === this.selectedId,
highlighted: currentSectionData.section.id === section.id, highlighted: currentSectionData.section.id === section.id,
hasVisibleModules: modules.length > 0, hasVisibleModules: modules.length > 0,
@ -160,6 +161,8 @@ type CourseIndexSection = {
expanded: boolean; expanded: boolean;
hasVisibleModules: boolean; hasVisibleModules: boolean;
availabilityinfo: boolean; availabilityinfo: boolean;
visible: boolean;
uservisible: boolean;
modules: { modules: {
id: number; id: number;
course: number; course: number;