diff options
Diffstat (limited to 'src/DevHive.Angular')
| -rw-r--r-- | src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.html | 4 | ||||
| -rw-r--r-- | src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.ts | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.html b/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.html index a8ebce7..4d381d1 100644 --- a/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.html +++ b/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.html @@ -10,8 +10,8 @@ </div> <div class="show-full-attachment" *ngIf="showFull" (click)="toggleShowFull()"> - <img class="attachment-img" *ngIf="paramURL.includes('image')" src="{{paramURL}}"> - <a class="attachment-download submit-btn" *ngIf="!paramURL.includes('image')" href="{{paramURL}}">Download attachment</a> + <img class="attachment-img" *ngIf="isImage" src="{{paramURL}}"> + <a class="attachment-download submit-btn" *ngIf="!isImage" href="{{paramURL}}">Download attachment</a> <div class="close"> ☒ </div> diff --git a/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.ts b/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.ts index 6c468b0..1d00def 100644 --- a/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.ts +++ b/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.ts @@ -7,6 +7,7 @@ import { Component, Input, OnInit } from '@angular/core'; }) export class PostAttachmentComponent implements OnInit { @Input() paramURL: string; + public isImage = false; public showFull = false; public fileName: string; public fileType: string; @@ -15,7 +16,8 @@ export class PostAttachmentComponent implements OnInit { { } ngOnInit(): void { - this.fileType = this.paramURL.includes('image') ? 'img' : 'raw'; + this.isImage = this.paramURL.includes('image') && !this.paramURL.endsWith('pdf'); + this.fileType = this.isImage ? 'img' : 'raw'; this.fileName = this.paramURL.match('(?<=\/)(?:.(?!\/))+$')?.pop() ?? 'Attachment'; } |
