Skip to content

Commit 6411630

Browse files
authored
Merge pull request #4189 from alfonso-salces/MOBILE-2256
MOBILE-2256 privatefiles: Remove private files
2 parents 9ee4968 + 27fd71f commit 6411630

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/addons/privatefiles/components/file/file.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ export class AddonPrivateFilesFileComponent extends CoreFileComponent implements
4040
this.onOpenMenuClick = new EventEmitter<CoreFileComponent>();
4141
}
4242

43+
/**
44+
* Emits onOpenMenuClick event with the current instance.
45+
*/
4346
openMenuClick(): void {
4447
this.onOpenMenuClick.emit(this);
4548
}

src/addons/privatefiles/pages/index/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<h1>{{ selectFilesEnabled() ? (selectedFiles.length + ' ' + title) : title }}</h1>
1414
</ion-title>
1515
<ion-buttons slot="end">
16-
@if (selectFilesEnabled()) {
16+
@if (selectFilesEnabled() && selectedFiles.length > 0) {
1717
<ion-button fill="clear" (click)="deleteSelectedFiles(true)" [ariaLabel]="'core.delete' | translate" color="danger">
1818
<ion-icon slot="icon-only" name="fas-trash" aria-hidden="true" />
1919
</ion-button>
@@ -76,7 +76,7 @@ <h1>{{ selectFilesEnabled() ? (selectedFiles.length + ' ' + title) : title }}</h
7676
@if (showUpload && root !== 'site' && !path && !selectFilesEnabled()) {
7777
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end">
7878
<ion-fab-button (click)="uploadFile()" [attr.aria-label]="'core.fileuploader.uploadafile' | translate">
79-
<ion-icon name="fas-plus" aria-hidden="true" />
79+
<ion-icon name="fas-arrow-up-from-bracket" aria-hidden="true" />
8080
<span class="sr-only">{{ 'core.fileuploader.uploadafile' | translate }}</span>
8181
</ion-fab-button>
8282
</ion-fab>

src/addons/privatefiles/pages/index/index.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,18 @@ export class AddonPrivateFilesIndexPage implements OnInit, OnDestroy {
298298
* Delete private files.
299299
*/
300300
async deleteSelectedFiles(showConfirmation = false): Promise<void> {
301+
if (this.selectedFiles.length === 0) {
302+
return;
303+
}
304+
301305
if (showConfirmation) {
302306
try {
303-
await CoreDomUtils.showDeleteConfirm('core.confirmremoveselectedfiles');
307+
this.selectedFiles.length === 1
308+
? await CoreDomUtils.showDeleteConfirm(
309+
'core.confirmremoveselectedfile',
310+
{ filename: this.selectedFiles[0].filename },
311+
)
312+
: await CoreDomUtils.showDeleteConfirm('core.confirmremoveselectedfiles');
304313
} catch {
305314
return;
306315
}
@@ -360,6 +369,7 @@ export class AddonPrivateFilesIndexPage implements OnInit, OnDestroy {
360369
cancelFileSelection(): void {
361370
this.selectFilesEnabled.set(false);
362371
this.selectedFiles = [];
372+
this.files = this.files?.map(file => ({ ...file, selected: false }));
363373
}
364374

365375
/**

0 commit comments

Comments
 (0)