From dfd844124d8033909ce631dfa426f31ae9ae1e48 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Mon, 7 Dec 2020 22:29:51 +0100 Subject: [PATCH] addresses #107 --- .../document-card-small.component.html | 12 +++++++++--- .../document-card-small.component.scss | 4 ++-- .../document-card-small.component.ts | 17 +++++++++++++++++ 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html index 71a7fb01a..95cf2e191 100644 --- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html +++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html @@ -1,8 +1,14 @@
-
-
- +
+ +
+
+ +
+
+ + {{moreTags}} +
diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.scss b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.scss index ef00ad029..0068667d0 100644 --- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.scss +++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.scss @@ -1,5 +1,5 @@ .doc-img { - background-size: cover; - background-position: top; + object-fit: cover; + object-position: top; height: 200px; } \ No newline at end of file diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts index 08202bfc9..d60552d4f 100644 --- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts +++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts @@ -1,4 +1,5 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { map } from 'rxjs/operators'; import { PaperlessDocument } from 'src/app/data/paperless-document'; import { PaperlessTag } from 'src/app/data/paperless-tag'; import { DocumentService } from 'src/app/services/rest/document.service'; @@ -21,6 +22,8 @@ export class DocumentCardSmallComponent implements OnInit { @Output() clickCorrespondent = new EventEmitter() + moreTags: number = null + ngOnInit(): void { } @@ -35,4 +38,18 @@ export class DocumentCardSmallComponent implements OnInit { getPreviewUrl() { return this.documentService.getPreviewUrl(this.document.id) } + + getTagsLimited$() { + return this.document.tags$.pipe( + map(tags => { + if (tags.length > 7) { + this.moreTags = tags.length - 6 + return tags.slice(0, 6) + } else { + return tags + } + }) + ) + } + }