MOBILE-3167 blocks: Check block visibility

main
Pau Ferrer Ocaña 2019-09-23 13:35:25 +02:00
parent 6964c01c77
commit be6824d58c
4 changed files with 7 additions and 5 deletions

View File

@ -57,8 +57,10 @@ export class CoreBlockComponent implements OnInit, OnDestroy, DoCheck {
return;
}
// Get the data to render the block.
this.initBlock();
if (this.block.visible) {
// Get the data to render the block.
this.initBlock();
}
}
/**

View File

@ -1,4 +1,4 @@
<!-- Only render the block if it's supported. -->
<div *ngIf="loaded && componentClass" class="{{class}}">
<div *ngIf="loaded && componentClass && block.visible" class="{{class}}">
<core-dynamic-component [component]="componentClass" [data]="data"></core-dynamic-component>
</div>

View File

@ -7,7 +7,7 @@
<ion-list>
<!-- Course blocks. -->
<ng-container *ngFor="let block of blocks">
<core-block [block]="block" contextLevel="course" [instanceId]="courseId" [extraData]="{'downloadEnabled': downloadEnabled}"></core-block>
<core-block *ngIf="block.visible" [block]="block" contextLevel="course" [instanceId]="courseId" [extraData]="{'downloadEnabled': downloadEnabled}"></core-block>
</ng-container>
</ion-list>
</core-loading>

View File

@ -42,7 +42,7 @@
<ion-list>
<!-- Dashboard blocks. -->
<ng-container *ngFor="let block of blocks">
<core-block [block]="block" contextLevel="user" [instanceId]="userId" [extraData]="{'downloadEnabled': downloadEnabled}"></core-block>
<core-block *ngIf="block.visible" [block]="block" contextLevel="user" [instanceId]="userId" [extraData]="{'downloadEnabled': downloadEnabled}"></core-block>
</ng-container>
</ion-list>