mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-01 11:19:32 -05:00

This reverts commit 8da15215087e4b7d605dc7fd32985fb5a656ff5d, reversing changes made to a7846925b1892c7c1148723b559135bc0fd7e47d.
66 lines
1.6 KiB
TypeScript
66 lines
1.6 KiB
TypeScript
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
import { map } from 'rxjs/operators';
|
|
import { PaperlessDocument } from 'src/app/data/paperless-document';
|
|
import { DocumentService } from 'src/app/services/rest/document.service';
|
|
import { SettingsService, SETTINGS_KEYS } from 'src/app/services/settings.service';
|
|
|
|
@Component({
|
|
selector: 'app-document-card-small',
|
|
templateUrl: './document-card-small.component.html',
|
|
styleUrls: ['./document-card-small.component.scss']
|
|
})
|
|
export class DocumentCardSmallComponent implements OnInit {
|
|
|
|
constructor(private documentService: DocumentService, private settingsService: SettingsService) { }
|
|
|
|
@Input()
|
|
selected = false
|
|
|
|
@Output()
|
|
toggleSelected = new EventEmitter()
|
|
|
|
@Input()
|
|
document: PaperlessDocument
|
|
|
|
@Output()
|
|
clickTag = new EventEmitter<number>()
|
|
|
|
@Output()
|
|
clickCorrespondent = new EventEmitter<number>()
|
|
|
|
moreTags: number = null
|
|
|
|
ngOnInit(): void {
|
|
}
|
|
|
|
getIsThumbInverted() {
|
|
return this.settingsService.get(SETTINGS_KEYS.DARK_MODE_THUMB_INVERTED)
|
|
}
|
|
|
|
getThumbUrl() {
|
|
return this.documentService.getThumbUrl(this.document.id)
|
|
}
|
|
|
|
getDownloadUrl() {
|
|
return this.documentService.getDownloadUrl(this.document.id)
|
|
}
|
|
|
|
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
|
|
}
|
|
})
|
|
)
|
|
}
|
|
|
|
}
|