commit
6fb5657869
|
@ -1,9 +1,9 @@
|
||||||
<ion-button fill="clear" (click)="scroll('backward')" [hidden]="scrollPosition === 'hidden'" [disabled]="scrollPosition === 'start'"
|
<ion-button fill="clear" (click)="scroll($event, 'backward')" [hidden]="scrollPosition === 'hidden'" [disabled]="scrollPosition === 'start'"
|
||||||
[attr.aria-label]="'core.scrollbackward' | translate" [attr.aria-controls]="targetId">
|
[attr.aria-label]="'core.scrollbackward' | translate" [attr.aria-controls]="targetId">
|
||||||
<ion-icon name="fas-chevron-left" slot="icon-only" aria-hidden="true" flip-rtl="false"></ion-icon>
|
<ion-icon name="fas-chevron-left" slot="icon-only" aria-hidden="true" flip-rtl="false"></ion-icon>
|
||||||
</ion-button>
|
</ion-button>
|
||||||
|
|
||||||
<ion-button fill="clear" (click)="scroll('forward')" [hidden]="scrollPosition === 'hidden'" [disabled]="scrollPosition === 'end'"
|
<ion-button fill="clear" (click)="scroll($event, 'forward')" [hidden]="scrollPosition === 'hidden'" [disabled]="scrollPosition === 'end'"
|
||||||
[attr.aria-label]="'core.scrollforward' | translate" [attr.aria-controls]="targetId">
|
[attr.aria-label]="'core.scrollforward' | translate" [attr.aria-controls]="targetId">
|
||||||
<ion-icon name="fas-chevron-right" slot="icon-only" aria-hidden="true" flip-rtl="false"></ion-icon>
|
<ion-icon name="fas-chevron-right" slot="icon-only" aria-hidden="true" flip-rtl="false"></ion-icon>
|
||||||
</ion-button>
|
</ion-button>
|
||||||
|
|
|
@ -44,13 +44,17 @@ export class CoreHorizontalScrollControlsComponent {
|
||||||
/**
|
/**
|
||||||
* Scroll the target in the given direction.
|
* Scroll the target in the given direction.
|
||||||
*
|
*
|
||||||
|
* @param ev Click event
|
||||||
* @param direction Scroll direction.
|
* @param direction Scroll direction.
|
||||||
*/
|
*/
|
||||||
scroll(direction: 'forward' | 'backward'): void {
|
scroll(ev: Event, direction: 'forward' | 'backward'): void {
|
||||||
if (!this.target) {
|
if (!this.target) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ev.stopPropagation();
|
||||||
|
ev.preventDefault();
|
||||||
|
|
||||||
const leftDelta = direction === 'forward' ? this.target.clientWidth : -this.target.clientWidth;
|
const leftDelta = direction === 'forward' ? this.target.clientWidth : -this.target.clientWidth;
|
||||||
const newScrollLeft = Math.max(
|
const newScrollLeft = Math.max(
|
||||||
Math.min(
|
Math.min(
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content [fullscreen]="true">
|
<ion-content>
|
||||||
<ion-refresher slot="fixed" [disabled]="!dataLoaded" (ionRefresh)="refreshData($event.target)">
|
<ion-refresher slot="fixed" [disabled]="!dataLoaded" (ionRefresh)="refreshData($event.target)">
|
||||||
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
|
@ -163,8 +163,6 @@ export class CoreCoursesCourseListItemComponent implements OnInit, OnDestroy, On
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a course.
|
* Open a course.
|
||||||
*
|
|
||||||
* @param course The course to open.
|
|
||||||
*/
|
*/
|
||||||
openCourse(): void {
|
openCourse(): void {
|
||||||
if (this.isEnrolled) {
|
if (this.isEnrolled) {
|
||||||
|
@ -179,6 +177,8 @@ export class CoreCoursesCourseListItemComponent implements OnInit, OnDestroy, On
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize prefetch course.
|
* Initialize prefetch course.
|
||||||
|
*
|
||||||
|
* @param forceInit Force initialization of prefetch course info.
|
||||||
*/
|
*/
|
||||||
async initPrefetchCourse(forceInit = false): Promise<void> {
|
async initPrefetchCourse(forceInit = false): Promise<void> {
|
||||||
if (!this.isEnrolled || !this.showDownload ||
|
if (!this.isEnrolled || !this.showDownload ||
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
<core-loading [hideUntil]="loaded">
|
<core-loading [hideUntil]="loaded">
|
||||||
<ion-list class="list-item-limited-width">
|
<ion-list class="list-item-limited-width" *ngIf="hasMainBlocks">
|
||||||
<ng-container *ngFor="let block of blocks">
|
<ng-container *ngFor="let block of blocks">
|
||||||
<core-block *ngIf="block.visible" [block]="block" contextLevel="user" [instanceId]="userId"></core-block>
|
<core-block *ngIf="block.visible" [block]="block" contextLevel="user" [instanceId]="userId"></core-block>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
<core-block-side-blocks-button slot="fixed" *ngIf="hasSideBlocks" contextLevel="user" [instanceId]="userId">
|
<core-block-side-blocks-button slot="fixed" *ngIf="hasSideBlocks" contextLevel="user" [instanceId]="userId">
|
||||||
</core-block-side-blocks-button>
|
</core-block-side-blocks-button>
|
||||||
|
|
||||||
<core-empty-box *ngIf="blocks.length == 0" icon="fas-cubes" [message]="'core.course.nocontentavailable' | translate">
|
<core-empty-box *ngIf="!hasMainBlocks" icon="fas-cubes" [message]="'core.course.nocontentavailable' | translate">
|
||||||
</core-empty-box>
|
</core-empty-box>
|
||||||
</core-loading>
|
</core-loading>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
|
@ -36,6 +36,7 @@ export class CoreCoursesDashboardPage implements OnInit, OnDestroy {
|
||||||
|
|
||||||
@ViewChildren(CoreBlockComponent) blocksComponents?: QueryList<CoreBlockComponent>;
|
@ViewChildren(CoreBlockComponent) blocksComponents?: QueryList<CoreBlockComponent>;
|
||||||
|
|
||||||
|
hasMainBlocks = false;
|
||||||
hasSideBlocks = false;
|
hasSideBlocks = false;
|
||||||
searchEnabled = false;
|
searchEnabled = false;
|
||||||
downloadCourseEnabled = false;
|
downloadCourseEnabled = false;
|
||||||
|
@ -84,6 +85,7 @@ export class CoreCoursesDashboardPage implements OnInit, OnDestroy {
|
||||||
|
|
||||||
this.blocks = blocks.mainBlocks;
|
this.blocks = blocks.mainBlocks;
|
||||||
|
|
||||||
|
this.hasMainBlocks = CoreBlockDelegate.hasSupportedBlock(blocks.mainBlocks);
|
||||||
this.hasSideBlocks = CoreBlockDelegate.hasSupportedBlock(blocks.sideBlocks);
|
this.hasSideBlocks = CoreBlockDelegate.hasSupportedBlock(blocks.sideBlocks);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
CoreDomUtils.showErrorModal(error);
|
CoreDomUtils.showErrorModal(error);
|
||||||
|
|
|
@ -137,11 +137,11 @@ export class CoreUserProvider {
|
||||||
|
|
||||||
const result = await site.write<CoreUserUpdatePictureWSResponse>('core_user_update_picture', params);
|
const result = await site.write<CoreUserUpdatePictureWSResponse>('core_user_update_picture', params);
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success || !result.profileimageurl) {
|
||||||
return Promise.reject(null);
|
return Promise.reject(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.profileimageurl!;
|
return result.profileimageurl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -452,7 +452,7 @@ export class CoreUserProvider {
|
||||||
name,
|
name,
|
||||||
};
|
};
|
||||||
const preSets: CoreSiteWSPreSets = {
|
const preSets: CoreSiteWSPreSets = {
|
||||||
cacheKey: this.getUserPreferenceCacheKey(params.name!),
|
cacheKey: this.getUserPreferenceCacheKey(name),
|
||||||
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
|
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -613,7 +613,7 @@ export class CoreUserProvider {
|
||||||
const treated: Record<string, boolean> = {};
|
const treated: Record<string, boolean> = {};
|
||||||
|
|
||||||
await Promise.all(userIds.map(async (userId) => {
|
await Promise.all(userIds.map(async (userId) => {
|
||||||
if (userId === null) {
|
if (userId === null || !siteId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,7 +630,7 @@ export class CoreUserProvider {
|
||||||
const profile = await this.getProfile(userId, courseId, false, siteId);
|
const profile = await this.getProfile(userId, courseId, false, siteId);
|
||||||
|
|
||||||
if (profile.profileimageurl) {
|
if (profile.profileimageurl) {
|
||||||
await CoreFilepool.addToQueueByUrl(siteId!, profile.profileimageurl);
|
await CoreFilepool.addToQueueByUrl(siteId, profile.profileimageurl);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.warn(`Ignore error when prefetching user ${userId}`, error);
|
this.logger.warn(`Ignore error when prefetching user ${userId}`, error);
|
||||||
|
@ -658,7 +658,7 @@ export class CoreUserProvider {
|
||||||
const promises = entries.map(async (entry) => {
|
const promises = entries.map(async (entry) => {
|
||||||
const imageUrl = <string> entry[propertyName];
|
const imageUrl = <string> entry[propertyName];
|
||||||
|
|
||||||
if (!imageUrl || treated[imageUrl]) {
|
if (!imageUrl || treated[imageUrl] || !siteId) {
|
||||||
// It doesn't have an image or it has already been treated.
|
// It doesn't have an image or it has already been treated.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -666,7 +666,7 @@ export class CoreUserProvider {
|
||||||
treated[imageUrl] = true;
|
treated[imageUrl] = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await CoreFilepool.addToQueueByUrl(siteId!, imageUrl);
|
await CoreFilepool.addToQueueByUrl(siteId, imageUrl);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
this.logger.warn(`Ignore error when prefetching user avatar ${imageUrl}`, entry, ex);
|
this.logger.warn(`Ignore error when prefetching user avatar ${imageUrl}`, entry, ex);
|
||||||
}
|
}
|
||||||
|
@ -682,7 +682,7 @@ export class CoreUserProvider {
|
||||||
* @param search The string to search.
|
* @param search The string to search.
|
||||||
* @param searchAnywhere Whether to find a match anywhere or only at the beginning.
|
* @param searchAnywhere Whether to find a match anywhere or only at the beginning.
|
||||||
* @param page Page to get.
|
* @param page Page to get.
|
||||||
* @param limitNumber Number of participants to get.
|
* @param perPage Number of participants to get.
|
||||||
* @param siteId Site Id. If not defined, use current site.
|
* @param siteId Site Id. If not defined, use current site.
|
||||||
* @return Promise resolved when the participants are retrieved.
|
* @return Promise resolved when the participants are retrieved.
|
||||||
* @since 3.8
|
* @since 3.8
|
||||||
|
|
Loading…
Reference in New Issue