MOBILE-3320 folder: Fix refresh menu item

main
Noel De Martin 2021-06-28 17:46:21 +02:00
parent 03abc8e178
commit cb50d9461d
2 changed files with 7 additions and 5 deletions

View File

@ -34,8 +34,8 @@
contextLevel="module" [contextInstanceId]="module.id" [courseId]="courseId">
</core-course-module-description>
<ion-list *ngIf="subfolder && (subfolder!.files.length + subfolder!.folders.length > 0)">
<ng-container *ngFor="let folder of subfolder!.folders">
<ion-list *ngIf="contents && (contents!.files.length + contents!.folders.length > 0)">
<ng-container *ngFor="let folder of contents!.folders">
<ion-item class="item-file" (click)="openFolder(folder)" detail="true" button>
<ion-icon name="fas-folder" slot="start" [attr.aria-label]="'core.folder' | translate"></ion-icon>
<ion-label>
@ -43,12 +43,12 @@
</ion-label>
</ion-item>
</ng-container>
<ng-container *ngFor="let file of subfolder!.files">
<ng-container *ngFor="let file of contents!.files">
<core-file [file]="file" [component]="component" [componentId]="componentId"></core-file>
</ng-container>
</ion-list>
<core-empty-box *ngIf="!subfolder || (subfolder!.files.length + subfolder!.folders.length == 0)" icon="far-folder-open"
<core-empty-box *ngIf="!contents || (contents!.files.length + contents!.folders.length == 0)" icon="far-folder-open"
[message]=" 'addon.mod_folder.emptyfilelist' | translate"></core-empty-box>
</core-loading>

View File

@ -42,6 +42,7 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo
component = AddonModFolderProvider.COMPONENT;
canGetFolder = false;
contents?: AddonModFolderFolderFormattedData;
constructor(@Optional() courseContentsPage?: CoreCourseContentsPage) {
super('AddonModFolderIndexComponent', courseContentsPage);
@ -57,6 +58,7 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo
if (this.subfolder) {
this.description = this.folderInstance ? this.folderInstance.intro : this.module.description;
this.contents = this.subfolder;
this.loaded = true;
this.refreshIcon = CoreConstants.ICON_REFRESH;
@ -112,7 +114,7 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo
this.dataRetrieved.emit(this.folderInstance || this.module);
this.description = this.folderInstance ? this.folderInstance.intro : this.module.description;
this.subfolder = AddonModFolderHelper.formatContents(this.module.contents);
this.contents = AddonModFolderHelper.formatContents(this.module.contents);
} finally {
this.fillContextMenu(refresh);
}