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>
<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">
<core-block *ngIf="block.visible" [block]="block" contextLevel="user" [instanceId]="userId"></core-block>
</ng-container>
@ -18,7 +18,7 @@
<core-block-side-blocks-button slot="fixed" *ngIf="hasSideBlocks" contextLevel="user" [instanceId]="userId">
</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-loading>
</ion-content>

View File

@ -36,6 +36,7 @@ export class CoreCoursesDashboardPage implements OnInit, OnDestroy {
@ViewChildren(CoreBlockComponent) blocksComponents?: QueryList<CoreBlockComponent>;
hasMainBlocks = false;
hasSideBlocks = false;
searchEnabled = false;
downloadCourseEnabled = false;
@ -84,6 +85,7 @@ export class CoreCoursesDashboardPage implements OnInit, OnDestroy {
this.blocks = blocks.mainBlocks;
this.hasMainBlocks = CoreBlockDelegate.hasSupportedBlock(blocks.mainBlocks);
this.hasSideBlocks = CoreBlockDelegate.hasSupportedBlock(blocks.sideBlocks);
} catch (error) {
CoreDomUtils.showErrorModal(error);