MOBILE-4081 dashboard: Check if dashboard has enabled blocks

main
Pau Ferrer Ocaña 2022-10-18 12:12:29 +02:00
parent 345de61759
commit 00693c9a87
2 changed files with 4 additions and 2 deletions

View File

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

View File

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