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>
|
<core-spacer *ngIf="filter.course || filter.category || filter.group"></core-spacer>
|
||||||
<ng-container *ngIf="filter.course || filter.category || filter.group">
|
<ng-container *ngIf="filter.course || filter.category || filter.group">
|
||||||
<ion-radio-group [(ngModel)]="courseId" (ionChange)="onChange()">
|
<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>
|
<ion-label>
|
||||||
<core-format-text [text]="course.fullname"></core-format-text>
|
<core-format-text [text]="course.shortname"></core-format-text>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
<ion-radio slot="end" [value]="course.id"></ion-radio>
|
<ion-radio slot="end" [value]="course.id"></ion-radio>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
|
@ -30,6 +30,7 @@ import { AddonCalendarFilter, AddonCalendarEventIcons } from '../../services/cal
|
||||||
})
|
})
|
||||||
export class AddonCalendarFilterComponent implements OnInit {
|
export class AddonCalendarFilterComponent implements OnInit {
|
||||||
|
|
||||||
|
@Input() courses: Partial<CoreEnrolledCourseData>[] = [];
|
||||||
@Input() filter: AddonCalendarFilter = {
|
@Input() filter: AddonCalendarFilter = {
|
||||||
filtered: false,
|
filtered: false,
|
||||||
courseId: undefined,
|
courseId: undefined,
|
||||||
|
@ -42,10 +43,9 @@ export class AddonCalendarFilterComponent implements OnInit {
|
||||||
};
|
};
|
||||||
|
|
||||||
courseId = -1;
|
courseId = -1;
|
||||||
|
|
||||||
@Input() courses: Partial<CoreEnrolledCourseData>[] = [];
|
|
||||||
typeIcons: AddonCalendarEventIcons[] = [];
|
typeIcons: AddonCalendarEventIcons[] = [];
|
||||||
types: string[] = [];
|
types: string[] = [];
|
||||||
|
sortedCourses: Partial<CoreEnrolledCourseData>[] = [];
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
CoreUtils.enumKeys(AddonCalendarEventType).forEach((name) => {
|
CoreUtils.enumKeys(AddonCalendarEventType).forEach((name) => {
|
||||||
|
@ -61,6 +61,9 @@ export class AddonCalendarFilterComponent implements OnInit {
|
||||||
*/
|
*/
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.courseId = this.filter.courseId || -1;
|
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