diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-02-02 20:14:57 +0200 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-02-02 20:14:57 +0200 |
| commit | ab63ab8d0099bae3b454886abc4ef4150d84d4e9 (patch) | |
| tree | ae3a41e58a63671fc4c50c5ce043a5c55f85ca2f /src | |
| parent | daee45c90d9699d392f1b16df041fccf46a4de4f (diff) | |
| download | DevHive-ab63ab8d0099bae3b454886abc4ef4150d84d4e9.tar DevHive-ab63ab8d0099bae3b454886abc4ef4150d84d4e9.tar.gz DevHive-ab63ab8d0099bae3b454886abc4ef4150d84d4e9.zip | |
Proper file names are now shown in posts and post edit page
Diffstat (limited to 'src')
3 files changed, 7 insertions, 1 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 e7889f0..a8ebce7 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 @@ -1,7 +1,7 @@ <div class="attachment"> <div class="clickable" (click)="toggleShowFull()"> <div class="attachment-name"> - Attachment + {{ fileName }} </div> <div class="attachment-type"> {{ fileType }} 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 d2aa636..6c468b0 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 @@ -8,6 +8,7 @@ import { Component, Input, OnInit } from '@angular/core'; export class PostAttachmentComponent implements OnInit { @Input() paramURL: string; public showFull = false; + public fileName: string; public fileType: string; constructor() @@ -15,6 +16,7 @@ export class PostAttachmentComponent implements OnInit { ngOnInit(): void { this.fileType = this.paramURL.includes('image') ? 'img' : 'raw'; + this.fileName = this.paramURL.match('(?<=\/)(?:.(?!\/))+$')?.pop() ?? 'Attachment'; } toggleShowFull(): void { diff --git a/src/DevHive.Angular/src/app/components/post-page/post-page.component.ts b/src/DevHive.Angular/src/app/components/post-page/post-page.component.ts index 21a5e50..39365d7 100644 --- a/src/DevHive.Angular/src/app/components/post-page/post-page.component.ts +++ b/src/DevHive.Angular/src/app/components/post-page/post-page.component.ts @@ -66,6 +66,10 @@ export class PostPageComponent implements OnInit { this._cloudinaryService.getFileRequest(fileURL).subscribe( (result: object) => { const file = result as File; + const tmp = { + name: fileURL.match('(?<=\/)(?:.(?!\/))+$')?.pop() ?? 'Attachment' + }; + Object.assign(file, tmp); this.files.push(file); } ); |
