From 77aa8c5119a24bbd9ebdaefd044731ef02786c89 Mon Sep 17 00:00:00 2001 From: Vlad Nouski Date: Fri, 12 Jan 2024 15:25:00 +0100 Subject: [PATCH 1/2] [DSC-1456] feature: filters visible in the search sidebar --- .../search/search-filters/search-filters.component.html | 2 +- .../search-filters/search-filters.component.spec.ts | 2 +- .../search/search-filters/search-filters.component.ts | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/app/shared/search/search-filters/search-filters.component.html b/src/app/shared/search/search-filters/search-filters.component.html index 2909d31766e..d8762ed0331 100644 --- a/src/app/shared/search/search-filters/search-filters.component.html +++ b/src/app/shared/search/search-filters/search-filters.component.html @@ -1,4 +1,4 @@ -
+

{{"search.filters.head" | translate}}

diff --git a/src/app/shared/search/search-filters/search-filters.component.spec.ts b/src/app/shared/search/search-filters/search-filters.component.spec.ts index 247df67ee53..c3a876c661b 100644 --- a/src/app/shared/search/search-filters/search-filters.component.spec.ts +++ b/src/app/shared/search/search-filters/search-filters.component.spec.ts @@ -76,7 +76,7 @@ describe('SearchFiltersComponent', () => { it('should not render component', () => { const menu = fixture.debugElement.query(By.css('div.d-none')); expect(menu).not.toBeNull(); - expect(comp.availableFilters).toBeFalse(); + expect(comp.searchFilterCount).toEqual(0); }); }); diff --git a/src/app/shared/search/search-filters/search-filters.component.ts b/src/app/shared/search/search-filters/search-filters.component.ts index c20a7e37d0f..bdd9729c4d0 100644 --- a/src/app/shared/search/search-filters/search-filters.component.ts +++ b/src/app/shared/search/search-filters/search-filters.component.ts @@ -63,7 +63,7 @@ export class SearchFiltersComponent implements OnInit, AfterViewChecked, OnDestr /** * counts for the active filters */ - availableFilters = false; + searchFilterCount = 0; /** * Link to the search page @@ -112,9 +112,11 @@ export class SearchFiltersComponent implements OnInit, AfterViewChecked, OnDestr } ngAfterViewChecked() { - this.availableFilters = false; + this.searchFilterCount = 0; this.searchFilter._results.forEach(element => { - this.availableFilters = element.nativeElement?.children[0]?.children.length > 0; + if (element.nativeElement?.children[0]?.children.length > 0) { + this.searchFilterCount++; + } }); } From 2371c8e32242481699f284c65e3b0c27f7a3c4b6 Mon Sep 17 00:00:00 2001 From: Vlad Nouski Date: Fri, 12 Jan 2024 15:25:00 +0100 Subject: [PATCH 2/2] [DSC-1456] feature: filters visible in the search sidebar --- .../search/search-filters/search-filters.component.html | 2 +- .../search-filters/search-filters.component.spec.ts | 2 +- .../search/search-filters/search-filters.component.ts | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/app/shared/search/search-filters/search-filters.component.html b/src/app/shared/search/search-filters/search-filters.component.html index 2909d31766e..d8762ed0331 100644 --- a/src/app/shared/search/search-filters/search-filters.component.html +++ b/src/app/shared/search/search-filters/search-filters.component.html @@ -1,4 +1,4 @@ -
+

{{"search.filters.head" | translate}}

diff --git a/src/app/shared/search/search-filters/search-filters.component.spec.ts b/src/app/shared/search/search-filters/search-filters.component.spec.ts index 247df67ee53..c3a876c661b 100644 --- a/src/app/shared/search/search-filters/search-filters.component.spec.ts +++ b/src/app/shared/search/search-filters/search-filters.component.spec.ts @@ -76,7 +76,7 @@ describe('SearchFiltersComponent', () => { it('should not render component', () => { const menu = fixture.debugElement.query(By.css('div.d-none')); expect(menu).not.toBeNull(); - expect(comp.availableFilters).toBeFalse(); + expect(comp.searchFilterCount).toEqual(0); }); }); diff --git a/src/app/shared/search/search-filters/search-filters.component.ts b/src/app/shared/search/search-filters/search-filters.component.ts index c20a7e37d0f..bdd9729c4d0 100644 --- a/src/app/shared/search/search-filters/search-filters.component.ts +++ b/src/app/shared/search/search-filters/search-filters.component.ts @@ -63,7 +63,7 @@ export class SearchFiltersComponent implements OnInit, AfterViewChecked, OnDestr /** * counts for the active filters */ - availableFilters = false; + searchFilterCount = 0; /** * Link to the search page @@ -112,9 +112,11 @@ export class SearchFiltersComponent implements OnInit, AfterViewChecked, OnDestr } ngAfterViewChecked() { - this.availableFilters = false; + this.searchFilterCount = 0; this.searchFilter._results.forEach(element => { - this.availableFilters = element.nativeElement?.children[0]?.children.length > 0; + if (element.nativeElement?.children[0]?.children.length > 0) { + this.searchFilterCount++; + } }); }