From de6ba3489a929408c1fae41fd2a6a44547299979 Mon Sep 17 00:00:00 2001
From: Michael Shamoon <4887959+nikonratm@users.noreply.github.com>
Date: Sat, 19 Dec 2020 21:56:31 -0800
Subject: [PATCH] Cleanup dropdown button component
---
.../filterable-dropdown-button.component.html | 6 +++---
.../filterable-dropdown-button.component.ts | 12 +++---------
2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown-button/filterable-dropdown-button.component.html b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown-button/filterable-dropdown-button.component.html
index 5b58025d1..75dadba53 100644
--- a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown-button/filterable-dropdown-button.component.html
+++ b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown-button/filterable-dropdown-button.component.html
@@ -5,8 +5,8 @@
-
-
{{item.name}}
+
+
{{toggleableItem?.item.name}}
- {{item.document_count}}
+ {{toggleableItem?.item.document_count}}
diff --git a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown-button/filterable-dropdown-button.component.ts b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown-button/filterable-dropdown-button.component.ts
index b0ced21cc..3486bdb46 100644
--- a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown-button/filterable-dropdown-button.component.ts
+++ b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown-button/filterable-dropdown-button.component.ts
@@ -9,22 +9,16 @@ import { ToggleableItem, ToggleableItemState } from '../filterable-dropdown.comp
templateUrl: './filterable-dropdown-button.component.html',
styleUrls: ['./filterable-dropdown-button.component.scss']
})
-export class FilterableDropdownButtonComponent implements OnInit {
+export class FilterableDropdownButtonComponent {
@Input()
toggleableItem: ToggleableItem
- get item(): PaperlessTag | PaperlessDocumentType | PaperlessCorrespondent {
- return this.toggleableItem?.item
- }
-
@Output()
toggle = new EventEmitter()
- isTag: boolean
-
- ngOnInit() {
- this.isTag = 'is_inbox_tag' in this.item // ~ this.item instanceof PaperlessTag
+ get isTag(): boolean {
+ return 'is_inbox_tag' in this.toggleableItem?.item // ~ this.item instanceof PaperlessTag
}
toggleItem(): void {