Merge pull request #2113 from crazyserver/MOBILE-3167

MOBILE-3167 blocks: Check block visibility
main
Juan Leyva 2019-10-01 13:01:55 +02:00 committed by GitHub
commit bcb41032f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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>