Merge pull request #2852 from NoelDeMartin/MOBILE-3320

MOBILE-3320: Component fixes
main
Dani Palou 2021-06-29 08:07:34 +02:00 committed by GitHub
commit 204d8dc0a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 7 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);
}

View File

@ -65,7 +65,7 @@
overflow-x: hidden;
overflow-y: auto;
cursor: text;
img {
::ng-deep img {
@include padding(null, null, null, 2px);
max-width: 95%;
width: auto;
@ -78,7 +78,7 @@
}
// Make empty elements selectable (to move the cursor).
*:empty:after {
::ng-deep *:empty:after {
content: '\200B';
}
}