Merge pull request #2297 from crazyserver/MOBILE-3281

Mobile 3281
main
Juan Leyva 2020-03-02 12:02:02 +01:00 committed by GitHub
commit 6937f350ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 10 deletions

View File

@ -189,6 +189,21 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity
Array.prototype.push.apply(this.entries, result.entries);
} else {
this.entries = result.entries;
if (this.splitviewCtrl.isOn()) {
// Load the first entry.
if (this.entries.length > 0) {
const found = this.selectedEntry && this.entries.some((entry) => entry.id == this.selectedEntry);
// The current selected entry is not found in the current list, open first item.
if (!found) {
this.openEntry(this.entries[0].id);
}
} else {
this.selectedEntry = null;
this.splitviewCtrl.emptyDetails();
}
}
}
this.canLoadMore = this.entries.length < result.count;
}).catch((error) => {

View File

@ -161,16 +161,10 @@ export class CoreUserParticipantsComponent implements OnInit {
this.displaySearchResults = false;
this.participants = [];
this.searchPage = 0;
this.splitviewCtrl.emptyDetails();
// Remove search results and display all participants.
this.participantsLoaded = false;
this.fetchData(true).then(() => {
if (this.splitviewCtrl.isOn() && this.participants.length > 0) {
// Take first and load it.
this.gotoParticipant(this.participants[0].id);
}
});
this.fetchData(true);
}
/**
@ -201,10 +195,20 @@ export class CoreUserParticipantsComponent implements OnInit {
this.canLoadMore = result.canLoadMore;
this.searchPage++;
if (!loadMore && this.splitviewCtrl.isOn() && this.participants.length > 0) {
// Take first and load it.
if (!loadMore && this.splitviewCtrl.isOn()) {
// Load the first entry.
if (this.participants.length > 0) {
const found = this.participantId && this.participants.some((user) => user.id == this.participantId);
// The current selected user is not found in the current list, open first item.
if (!found) {
this.gotoParticipant(this.participants[0].id);
}
} else {
this.participantId = null;
this.splitviewCtrl.emptyDetails();
}
}
}).catch((error) => {
this.domUtils.showErrorModalDefault(error, 'Error searching users.');