diff --git a/javascript/apps/taiga/src/app/shared/attachments/components/attachment/attachment.component.css b/javascript/apps/taiga/src/app/shared/attachments/components/attachment/attachment.component.css index 014121888..9e5e623f8 100644 --- a/javascript/apps/taiga/src/app/shared/attachments/components/attachment/attachment.component.css +++ b/javascript/apps/taiga/src/app/shared/attachments/components/attachment/attachment.component.css @@ -15,6 +15,12 @@ Copyright (c) 2023-present Kaleidos INC .row { block-size: var(--spacing-32); padding-block: var(--spacing-4); + + &:hover { + background-color: var(--color-gray20); + border-radius: var(--spacing-4); + cursor: pointer; + } } .name-column { diff --git a/javascript/apps/taiga/src/app/shared/attachments/components/attachment/attachment.component.html b/javascript/apps/taiga/src/app/shared/attachments/components/attachment/attachment.component.html index a0ef476ea..6c891532e 100644 --- a/javascript/apps/taiga/src/app/shared/attachments/components/attachment/attachment.component.html +++ b/javascript/apps/taiga/src/app/shared/attachments/components/attachment/attachment.component.html @@ -17,7 +17,8 @@ (confirm)="onConfirmDeleteFile()"> + data-test="attachment-row" + (click)="downloadAttachment()"> @@ -53,6 +54,7 @@ diff --git a/javascript/apps/taiga/src/app/shared/attachments/components/attachment/attachment.component.ts b/javascript/apps/taiga/src/app/shared/attachments/components/attachment/attachment.component.ts index 1d8526671..3b8d26d13 100644 --- a/javascript/apps/taiga/src/app/shared/attachments/components/attachment/attachment.component.ts +++ b/javascript/apps/taiga/src/app/shared/attachments/components/attachment/attachment.component.ts @@ -6,7 +6,14 @@ * Copyright (c) 2023-present Kaleidos INC */ -import { Component, Input, OnChanges, inject } from '@angular/core'; +import { + Component, + ElementRef, + Input, + OnChanges, + ViewChild, + inject, +} from '@angular/core'; import { CommonModule } from '@angular/common'; import { TranslocoModule } from '@ngneat/transloco'; import { TuiButtonModule, TuiSvgModule } from '@taiga-ui/core'; @@ -51,6 +58,9 @@ export class AttachmentComponent implements OnChanges { @Input() public canEdit = true; + @ViewChild('download', { read: ElementRef }) + public download!: ElementRef; + public extension = 'paperclip'; public state = inject(AttachmentsState); #initUndo$ = new Subject(); @@ -103,7 +113,8 @@ export class AttachmentComponent implements OnChanges { return 'progress' in attachment; }; - public deleteAttachment() { + public deleteAttachment(event: Event) { + event.stopPropagation(); this.#initUndo$.next(); } @@ -113,6 +124,10 @@ export class AttachmentComponent implements OnChanges { } } + public downloadAttachment() { + this.download.nativeElement.click(); + } + public ngOnChanges() { this.calculateExtension(); }