|
24 | 24 | </ion-label> |
25 | 25 | </ion-item> |
26 | 26 | <ng-container *ngIf="allSectionId !== section.id"> |
27 | | - <ion-item class="divider section" (click)="selectSectionOrModule($event, section.id)" button |
28 | | - [class.item-current]="selectedId === section.id" [class.item-dimmed]="!section.visible" |
29 | | - [class.item-hightlighted]="section.highlighted" [detail]="false"> |
30 | | - <ion-icon *ngIf="section.hasVisibleModules" name="fas-chevron-right" flip-rtl slot="start" |
31 | | - class="expandable-status-icon" (ariaButtonClick)="toggleExpand($event, section)" |
32 | | - [attr.aria-label]="(section.expanded ? 'core.collapse' : 'core.expand') | translate" |
33 | | - [attr.aria-expanded]="section.expanded" [attr.aria-controls]="'core-course-index-section-' + section.id" |
34 | | - [class.expandable-status-icon-expanded]="section.expanded" /> |
35 | | - <ion-icon *ngIf="!section.hasVisibleModules" name="" slot="start" aria-hidden="true" |
36 | | - class="expandable-status-icon" /> |
37 | | - <ion-label> |
38 | | - <h2> |
39 | | - <core-format-text [text]="section.name" contextLevel="course" [contextInstanceId]="course?.id" /> |
40 | | - </h2> |
41 | | - </ion-label> |
42 | | - <ion-badge *ngIf="section.highlighted && highlighted" slot="end">{{highlighted}}</ion-badge> |
43 | | - <ion-icon name="fas-lock" *ngIf="section.availabilityinfo" slot="end" class="restricted" |
44 | | - [attr.aria-label]="'core.restricted' | translate" /> |
45 | | - <ion-icon name="fas-eye-slash" *ngIf="!section.visible && !section.uservisible" slot="end" class="restricted" |
46 | | - [attr.aria-label]="'core.notavailable' | translate" /> |
47 | | - <ion-icon name="fas-eye-slash" *ngIf="!section.visible && section.uservisible" slot="end" class="restricted" |
48 | | - [attr.aria-label]="'core.course.hiddenfromstudents' | translate" /> |
49 | | - </ion-item> |
50 | | - <div id="core-course-index-section-{{section.id}}"> |
51 | | - <ng-container *ngIf="section.expanded"> |
52 | | - <ng-container *ngFor="let module of section.modules"> |
53 | | - <ion-item class="module" [class.item-dimmed]="!module.visible" [class.indented]="module.indented" |
54 | | - [class.item-hightlighted]="section.highlighted" |
55 | | - (click)="selectSectionOrModule($event, section.id, module.id)" button> |
56 | | - <ion-icon class="completioninfo completion_none" name="" *ngIf="module.completionStatus === undefined" |
57 | | - slot="start" aria-hidden="true" /> |
58 | | - <ion-icon class="completioninfo completion_incomplete" name="far-circle" |
59 | | - *ngIf="module.completionStatus === 0" slot="start" |
60 | | - [attr.aria-label]="'core.course.todo' | translate" /> |
61 | | - <ion-icon class="completioninfo completion_complete" name="fas-circle" |
62 | | - *ngIf="module.completionStatus === 1 || module.completionStatus === 2" color="success" slot="start" |
63 | | - [attr.aria-label]="'core.course.done' | translate" /> |
64 | | - <ion-icon class="completioninfo completion_fail" name="fas-xmark" *ngIf="module.completionStatus === 3" |
65 | | - color="danger" slot="start" [attr.aria-label]="'core.course.failed' | translate" /> |
66 | | - <ion-label> |
67 | | - <p class="item-heading"> |
68 | | - <core-format-text [text]="module.name" contextLevel="module" [contextInstanceId]="module.id" |
69 | | - [courseId]="module.course" /> |
70 | | - </p> |
71 | | - </ion-label> |
72 | | - <ion-icon name="fas-lock" *ngIf="!module.uservisible" slot="end" class="restricted" |
73 | | - [attr.aria-label]="'core.restricted' | translate" /> |
74 | | - </ion-item> |
75 | | - </ng-container> |
76 | | - </ng-container> |
77 | | - </div> |
| 27 | + <ng-container *ngTemplateOutlet="sectionTemplate; context: {section}" /> |
78 | 28 | </ng-container> |
79 | 29 | </ng-container> |
80 | 30 | </ion-list> |
81 | 31 | </core-loading> |
82 | 32 | </ion-content> |
| 33 | + |
| 34 | + |
| 35 | +<ng-template #sectionTemplate let-section="section"> |
| 36 | + <ion-item class="divider section" (click)="selectSectionOrModule($event, section.id)" button |
| 37 | + [class.item-current]="selectedId === section.id" [class.item-dimmed]="!section.visible" |
| 38 | + [class.item-hightlighted]="section.highlighted" [detail]="false"> |
| 39 | + <ion-icon *ngIf="section.hasVisibleModules" name="fas-chevron-right" flip-rtl slot="start" class="expandable-status-icon" |
| 40 | + (ariaButtonClick)="toggleExpand($event, section)" |
| 41 | + [attr.aria-label]="(section.expanded ? 'core.collapse' : 'core.expand') | translate" [attr.aria-expanded]="section.expanded" |
| 42 | + [attr.aria-controls]="'core-course-index-section-' + section.id" [class.expandable-status-icon-expanded]="section.expanded" /> |
| 43 | + <ion-icon *ngIf="!section.hasVisibleModules" name="" slot="start" aria-hidden="true" class="expandable-status-icon" /> |
| 44 | + <ion-label> |
| 45 | + <h2> |
| 46 | + <core-format-text [text]="section.name" contextLevel="course" [contextInstanceId]="course?.id" /> |
| 47 | + </h2> |
| 48 | + </ion-label> |
| 49 | + <ion-badge *ngIf="section.highlighted && highlighted" slot="end">{{highlighted}}</ion-badge> |
| 50 | + <ion-icon name="fas-lock" *ngIf="section.availabilityinfo" slot="end" class="restricted" |
| 51 | + [attr.aria-label]="'core.restricted' | translate" /> |
| 52 | + <ion-icon name="fas-eye-slash" *ngIf="!section.visible && !section.uservisible" slot="end" class="restricted" |
| 53 | + [attr.aria-label]="'core.notavailable' | translate" /> |
| 54 | + <ion-icon name="fas-eye-slash" *ngIf="!section.visible && section.uservisible" slot="end" class="restricted" |
| 55 | + [attr.aria-label]="'core.course.hiddenfromstudents' | translate" /> |
| 56 | + </ion-item> |
| 57 | + <div id="core-course-index-section-{{section.id}}" class="core-course-index-section-content"> |
| 58 | + <ng-container *ngIf="section.expanded"> |
| 59 | + <ng-container *ngFor="let module of section.modules"> |
| 60 | + @if (module.subSection) { |
| 61 | + <div class="core-course-index-subsection"> |
| 62 | + <ng-container *ngTemplateOutlet="sectionTemplate; context: {section: module.subSection}" /> |
| 63 | + </div> |
| 64 | + } @else { |
| 65 | + <ion-item class="module" [class.item-dimmed]="!module.visible" [class.indented]="module.indented" |
| 66 | + [class.item-hightlighted]="section.highlighted" (click)="selectSectionOrModule($event, section.id, module.id)" button> |
| 67 | + <ion-icon class="completioninfo completion_none" name="" *ngIf="module.completionStatus === undefined" slot="start" |
| 68 | + aria-hidden="true" /> |
| 69 | + <ion-icon class="completioninfo completion_incomplete" name="far-circle" *ngIf="module.completionStatus === 0" |
| 70 | + slot="start" [attr.aria-label]="'core.course.todo' | translate" /> |
| 71 | + <ion-icon class="completioninfo completion_complete" name="fas-circle" |
| 72 | + *ngIf="module.completionStatus === 1 || module.completionStatus === 2" color="success" slot="start" |
| 73 | + [attr.aria-label]="'core.course.done' | translate" /> |
| 74 | + <ion-icon class="completioninfo completion_fail" name="fas-xmark" *ngIf="module.completionStatus === 3" color="danger" |
| 75 | + slot="start" [attr.aria-label]="'core.course.failed' | translate" /> |
| 76 | + <ion-label> |
| 77 | + <p class="item-heading"> |
| 78 | + <core-format-text [text]="module.name" contextLevel="module" [contextInstanceId]="module.id" |
| 79 | + [courseId]="module.course" /> |
| 80 | + </p> |
| 81 | + </ion-label> |
| 82 | + <ion-icon name="fas-lock" *ngIf="!module.uservisible" slot="end" class="restricted" |
| 83 | + [attr.aria-label]="'core.restricted' | translate" /> |
| 84 | + </ion-item> |
| 85 | + } |
| 86 | + </ng-container> |
| 87 | + </ng-container> |
| 88 | + </div> |
| 89 | +</ng-template> |
0 commit comments