always show count badges

This commit is contained in:
jonaswinkler 2020-12-27 13:23:11 +01:00
parent bf79b252ad
commit 3dd4583ea8
5 changed files with 2 additions and 19 deletions

View File

@ -21,7 +21,7 @@
</div>
<div *ngIf="toggleableItems" class="items">
<ng-container *ngFor="let toggleableItem of toggleableItems | filter: filterText">
<app-toggleable-dropdown-button [toggleableItem]="toggleableItem" [showCounts]="showCounts" (toggle)="toggleItem($event)"></app-toggleable-dropdown-button>
<app-toggleable-dropdown-button [toggleableItem]="toggleableItem" (toggle)="toggleItem($event)"></app-toggleable-dropdown-button>
</ng-container>
</div>
<button *ngIf="type == types.Editing" class="list-group-item list-group-item-action bg-light" (click)="dropdown.close()" [disabled]="!hasBeenToggled || (toggleableItems | filter: filterText).length == 0">

View File

@ -76,17 +76,6 @@ export class FilterableDropdownComponent {
@Output()
editingComplete = new EventEmitter()
_showCounts: boolean = true
@Input()
set showCounts(show: boolean) {
this._showCounts = show
}
get showCounts(): boolean {
return this._showCounts && (this.type == FilterableDropdownType.Editing || (this.type == FilterableDropdownType.Filtering && this.itemsSelected.length == 0))
}
hasBeenToggled:boolean = false
constructor(private filterPipe: FilterPipe) { }

View File

@ -8,5 +8,5 @@
<app-tag *ngIf="isTag; else displayName" [tag]="toggleableItem?.item" [clickable]="true" linkTitle="Filter by tag"></app-tag>
<ng-template #displayName><small>{{toggleableItem?.item.name}}</small></ng-template>
</div>
<div *ngIf="showCounts" class="badge badge-light rounded-pill ml-auto mr-1">{{toggleableItem?.count}}</div>
<div class="badge badge-light rounded-pill ml-auto mr-1">{{toggleableItem?.count}}</div>
</button>

View File

@ -23,9 +23,6 @@ export class ToggleableDropdownButtonComponent {
@Input()
toggleableItem: ToggleableItem
@Input()
showCounts: boolean = true
@Output()
toggle = new EventEmitter()

View File

@ -32,21 +32,18 @@
<app-filterable-dropdown class="mr-2 mr-md-3" title="Tags" icon="tag-fill"
[toggleableItems]="tagsToggleableItems"
[type]="dropdownTypes.Editing"
[showCounts]="!selectionSpansPages"
(open)="tagsDropdownOpen()"
(editingComplete)="setTags($event)">
</app-filterable-dropdown>
<app-filterable-dropdown class="mr-2 mr-md-3" title="Correspondent" icon="person-fill" singular="true"
[toggleableItems]="correspondentsToggleableItems"
[type]="dropdownTypes.Editing"
[showCounts]="!selectionSpansPages"
(open)="correspondentsDropdownOpen()"
(editingComplete)="setCorrespondents($event)">
</app-filterable-dropdown>
<app-filterable-dropdown class="mr-2 mr-md-3" title="Document Type" icon="file-earmark-fill" singular="true"
[toggleableItems]="documentTypesToggleableItems"
[type]="dropdownTypes.Editing"
[showCounts]="!selectionSpansPages"
(open)="documentTypesDropdownOpen()"
(editingComplete)="setDocumentTypes($event)">
</app-filterable-dropdown>