Merge pull request #3650 from dpalou/MOBILE-4270

MOBILE-4270 core: Set right version for LMS 4.2
main
Pau Ferrer Ocaña 2023-05-04 10:11:10 +02:00 committed by GitHub
commit 3ddf2326a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 26 additions and 54 deletions

View File

@ -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>

View File

@ -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() ?? ''));
}
/**

View File

@ -21,7 +21,9 @@
<core-format-text [text]="event.name" [contextLevel]="event.contextLevel"
[contextInstanceId]="event.contextInstanceId"></core-format-text>
</p>
<p [innerHTML]="event.formattedtime"></p>
<p>
<core-format-text [text]="event.formattedtime" [filter]="false"></core-format-text>
</p>
</ion-label>
<ion-note *ngIf="event.offline && !event.deleted" slot="end">
<ion-icon name="fas-clock" aria-hidden="true"></ion-icon>

View File

@ -86,7 +86,9 @@
<core-format-text [text]="event.name" [contextLevel]="event.contextLevel"
[contextInstanceId]="event.contextInstanceId"></core-format-text>
</p>
<p [innerHTML]="event.formattedtime"></p>
<p>
<core-format-text [text]="event.formattedtime" [filter]="false"></core-format-text>
</p>
</ion-label>
<ion-note *ngIf="event.offline && !event.deleted" slot="end">
<ion-icon name="fas-clock" aria-hidden="true"></ion-icon>

View File

@ -235,10 +235,6 @@
</form>
<div collapsible-footer appearOnBottom *ngIf="loaded && !error" slot="fixed">
<div class="list-item-limited-width adaptable-buttons-row">
<ion-button *ngIf="hasOffline && eventId && eventId < 0" expand="block" fill="outline" (click)="discard()"
class="ion-margin ion-text-wrap">
{{ 'core.discard' | translate }}
</ion-button>
<ion-button expand="block" (click)="submit()" [disabled]="!form.valid" type="submit" class="ion-margin ion-text-wrap">
{{ 'core.save' | translate }}
</ion-button>

View File

@ -563,7 +563,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
*
* @param event Event.
*/
protected returnToList(event?: AddonCalendarEvent | AddonCalendarOfflineEventDBRecord): void {
protected returnToList(event: AddonCalendarEvent | AddonCalendarOfflineEventDBRecord): void {
// Unblock the sync because the view will be destroyed and the sync process could be triggered before ngOnDestroy.
this.unblockSync();
@ -575,50 +575,20 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
this.currentSite.getId(),
);
} else {
if (event) {
CoreEvents.trigger(
AddonCalendarProvider.NEW_EVENT_EVENT,
{
eventId: event.id,
oldEventId: this.eventId,
},
this.currentSite.getId(),
);
} else {
CoreEvents.trigger(AddonCalendarProvider.NEW_EVENT_DISCARDED_EVENT, {}, this.currentSite.getId());
}
CoreEvents.trigger(
AddonCalendarProvider.NEW_EVENT_EVENT,
{
eventId: event.id,
oldEventId: this.eventId,
},
this.currentSite.getId(),
);
}
this.originalData = undefined; // Avoid asking for confirmation.
CoreNavigator.back();
}
/**
* Discard an offline saved discussion.
*/
async discard(): Promise<void> {
if (!this.eventId) {
return;
}
try {
await CoreDomUtils.showConfirm(Translate.instant('core.areyousure'));
try {
await AddonCalendarOffline.deleteEvent(this.eventId);
CoreForms.triggerFormCancelledEvent(this.formElement, this.currentSite.getId());
this.returnToList();
} catch {
// Shouldn't happen.
CoreDomUtils.showErrorModal('Error discarding event.');
}
} catch {
// Ignore errors
}
}
/**
* Check if we can leave the page or not.
*

View File

@ -61,8 +61,7 @@
<ion-item class="ion-text-wrap">
<ion-label>
<p class="item-heading">{{ 'addon.calendar.when' | translate }}</p>
<core-format-text [text]="event.formattedtime" [contextLevel]="event.contextLevel"
[contextInstanceId]="event.contextInstanceId"></core-format-text>
<core-format-text [text]="event.formattedtime" [filter]="false"></core-format-text>
</ion-label>
<ion-note slot="end" *ngIf="event.deleted">
<ion-icon name="fas-trash" aria-hidden="true"></ion-icon> {{ 'core.deletedoffline' | translate }}

View File

@ -109,7 +109,7 @@ export class CoreSite {
'3.11': 2021051700,
'4.0': 2022041900,
'4.1': 2022112800,
'4.2': 2023011300, // @todo [4.2] replace with right value when released. Using a tmp value to be able to test new things.
'4.2': 2023042400,
};
// Possible cache update frequencies.

View File

@ -125,6 +125,8 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest
await this.enteredPromise,
]);
this.listenEvents();
await this.initializeFloatingTitle();
this.initializeContent();
}
@ -291,8 +293,6 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest
return;
}
this.listenEvents();
// Initialize from tabs.
const tabs = CoreDirectivesRegistry.resolve(this.page.querySelector('core-tabs-outlet'), CoreTabsOutletComponent);