MOBILE-4270 calendar: Make course filter list consistent with LMS
parent
c030fed670
commit
8ce5414980
|
@ -17,9 +17,9 @@
|
|||
<core-spacer *ngIf="filter.course || filter.category || filter.group"></core-spacer>
|
||||
<ng-container *ngIf="filter.course || filter.category || filter.group">
|
||||
<ion-radio-group [(ngModel)]="courseId" (ionChange)="onChange()">
|
||||
<ion-item class="ion-text-wrap" *ngFor="let course of courses">
|
||||
<ion-item class="ion-text-wrap" *ngFor="let course of sortedCourses">
|
||||
<ion-label>
|
||||
<core-format-text [text]="course.fullname"></core-format-text>
|
||||
<core-format-text [text]="course.shortname"></core-format-text>
|
||||
</ion-label>
|
||||
<ion-radio slot="end" [value]="course.id"></ion-radio>
|
||||
</ion-item>
|
||||
|
|
|
@ -30,6 +30,7 @@ import { AddonCalendarFilter, AddonCalendarEventIcons } from '../../services/cal
|
|||
})
|
||||
export class AddonCalendarFilterComponent implements OnInit {
|
||||
|
||||
@Input() courses: Partial<CoreEnrolledCourseData>[] = [];
|
||||
@Input() filter: AddonCalendarFilter = {
|
||||
filtered: false,
|
||||
courseId: undefined,
|
||||
|
@ -42,10 +43,9 @@ export class AddonCalendarFilterComponent implements OnInit {
|
|||
};
|
||||
|
||||
courseId = -1;
|
||||
|
||||
@Input() courses: Partial<CoreEnrolledCourseData>[] = [];
|
||||
typeIcons: AddonCalendarEventIcons[] = [];
|
||||
types: string[] = [];
|
||||
sortedCourses: Partial<CoreEnrolledCourseData>[] = [];
|
||||
|
||||
constructor() {
|
||||
CoreUtils.enumKeys(AddonCalendarEventType).forEach((name) => {
|
||||
|
@ -61,6 +61,9 @@ export class AddonCalendarFilterComponent implements OnInit {
|
|||
*/
|
||||
ngOnInit(): void {
|
||||
this.courseId = this.filter.courseId || -1;
|
||||
|
||||
this.sortedCourses = Array.from(this.courses)
|
||||
.sort((a, b) => (a.shortname?.toLowerCase() ?? '').localeCompare(b.shortname?.toLowerCase() ?? ''));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue