forked from CIT/Vmeda.Online
		
	MOBILE-2256 privatefiles: Remove private files
This commit is contained in:
		
							parent
							
								
									4c9b69879e
								
							
						
					
					
						commit
						27fd71fa17
					
				@ -40,6 +40,9 @@ export class AddonPrivateFilesFileComponent extends CoreFileComponent implements
 | 
			
		||||
        this.onOpenMenuClick = new EventEmitter<CoreFileComponent>();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Emits onOpenMenuClick event with the current instance.
 | 
			
		||||
     */
 | 
			
		||||
    openMenuClick(): void {
 | 
			
		||||
        this.onOpenMenuClick.emit(this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,7 @@
 | 
			
		||||
            <h1>{{ selectFilesEnabled() ? (selectedFiles.length + ' ' + title) : title }}</h1>
 | 
			
		||||
        </ion-title>
 | 
			
		||||
        <ion-buttons slot="end">
 | 
			
		||||
            @if (selectFilesEnabled()) {
 | 
			
		||||
            @if (selectFilesEnabled() && selectedFiles.length > 0) {
 | 
			
		||||
            <ion-button fill="clear" (click)="deleteSelectedFiles(true)" [ariaLabel]="'core.delete' | translate" color="danger">
 | 
			
		||||
                <ion-icon slot="icon-only" name="fas-trash" aria-hidden="true" />
 | 
			
		||||
            </ion-button>
 | 
			
		||||
@ -76,7 +76,7 @@
 | 
			
		||||
    @if (showUpload && root !== 'site' && !path && !selectFilesEnabled()) {
 | 
			
		||||
    <ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end">
 | 
			
		||||
        <ion-fab-button (click)="uploadFile()" [attr.aria-label]="'core.fileuploader.uploadafile' | translate">
 | 
			
		||||
            <ion-icon name="fas-plus" aria-hidden="true" />
 | 
			
		||||
            <ion-icon name="fas-arrow-up-from-bracket" aria-hidden="true" />
 | 
			
		||||
            <span class="sr-only">{{ 'core.fileuploader.uploadafile' | translate }}</span>
 | 
			
		||||
        </ion-fab-button>
 | 
			
		||||
    </ion-fab>
 | 
			
		||||
 | 
			
		||||
@ -298,9 +298,18 @@ export class AddonPrivateFilesIndexPage implements OnInit, OnDestroy {
 | 
			
		||||
     * Delete private files.
 | 
			
		||||
     */
 | 
			
		||||
    async deleteSelectedFiles(showConfirmation = false): Promise<void> {
 | 
			
		||||
        if (this.selectedFiles.length === 0) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (showConfirmation) {
 | 
			
		||||
            try {
 | 
			
		||||
                await CoreDomUtils.showDeleteConfirm('core.confirmremoveselectedfiles');
 | 
			
		||||
                this.selectedFiles.length === 1
 | 
			
		||||
                ? await CoreDomUtils.showDeleteConfirm(
 | 
			
		||||
                    'core.confirmremoveselectedfile',
 | 
			
		||||
                    { filename: this.selectedFiles[0].filename },
 | 
			
		||||
                )
 | 
			
		||||
                : await CoreDomUtils.showDeleteConfirm('core.confirmremoveselectedfiles');
 | 
			
		||||
            } catch {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
@ -360,6 +369,7 @@ export class AddonPrivateFilesIndexPage implements OnInit, OnDestroy {
 | 
			
		||||
    cancelFileSelection(): void {
 | 
			
		||||
        this.selectFilesEnabled.set(false);
 | 
			
		||||
        this.selectedFiles = [];
 | 
			
		||||
        this.files = this.files?.map(file => ({ ...file, selected: false }));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user