From 725a048a7c61a2f285af863375c007060bed5e52 Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Wed, 28 Oct 2020 09:50:41 +0100
Subject: [PATCH] FEAT #13271 TIME 0:10 hide no res filter

---
 .../app/search/filter-tool/filter-tool.component.html     | 8 +++++---
 .../app/search/filter-tool/filter-tool.component.scss     | 4 ++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/frontend/app/search/filter-tool/filter-tool.component.html b/src/frontend/app/search/filter-tool/filter-tool.component.html
index 33bc0ff3c18..9f04c61b4b4 100644
--- a/src/frontend/app/search/filter-tool/filter-tool.component.html
+++ b/src/frontend/app/search/filter-tool/filter-tool.component.html
@@ -8,9 +8,11 @@
         <div class="catGroupTitle">{{'lang.'+filterKey.key | translate}} ({{filters[filterKey.key]['values'].length}})</div>
         <mat-divider style="width: 80%;"></mat-divider>
         <ng-container *ngFor="let cat of filters[filterKey.key]['values'];let i=index">
-            <mat-list-option color="primary" class="catContent" *ngIf="i < 5 || filters[filterKey.key]['expand']" (click)="toggleFilter(filterKey.key,i)" [selected]="cat.selected" checkboxPosition="before" [disabled]="isLoadingResults">
-                <span class="catLabel" [title]="cat.label">{{cat.id !== null ? cat.label : 'lang.undefined' | translate}}</span><span class="catBadge">{{cat.count}}</span>
-            </mat-list-option>
+            <ng-container *ngIf="cat.count > 0 || (cat.count === 0 && cat.selected)">
+                <mat-list-option color="primary" class="catContent" *ngIf="i < 5 || filters[filterKey.key]['expand']" (click)="toggleFilter(filterKey.key,i)" [selected]="cat.selected" checkboxPosition="before" [disabled]="isLoadingResults">
+                    <span class="catLabel" [title]="cat.label">{{cat.id !== null ? cat.label : 'lang.undefined' | translate}}</span><span class="catBadge" [class.noRes]="cat.count === 0">{{cat.count}}</span>
+                </mat-list-option>
+            </ng-container>
         </ng-container>
         <button mat-button *ngIf="filters[filterKey.key]['values'].length > 5" style="width:100%;" color="primary" (click)="toggleDisplay(filterKey.key)">{{filters[filterKey.key]['expand'] ?  ('lang.less' | translate) : ('lang.more' | translate) }}<mat-icon style="height:auto;" class="fas" [class.fa-chevron-down]="!filters[filterKey.key]['expand']" [class.fa-chevron-up]="filters[filterKey.key]['expand']"></mat-icon></button>
     </mat-selection-list>
diff --git a/src/frontend/app/search/filter-tool/filter-tool.component.scss b/src/frontend/app/search/filter-tool/filter-tool.component.scss
index aba448d10fa..88b79d52974 100644
--- a/src/frontend/app/search/filter-tool/filter-tool.component.scss
+++ b/src/frontend/app/search/filter-tool/filter-tool.component.scss
@@ -63,3 +63,7 @@
     background: initial;
 }
 
+.noRes {
+    color: #666 !important;
+    opacity: 0.5;
+}
\ No newline at end of file
-- 
GitLab