Skip to content

Commit

Permalink
Merged in DSC-1456-filters-are-no-longer-visible-in-the-search-sideba…
Browse files Browse the repository at this point in the history
…r (pull request DSpace#1207)

[DSC-1456] feature: filters visible in the search sidebar

Approved-by: Giuseppe Digilio
  • Loading branch information
vNovski authored and atarix83 committed Jan 15, 2024
2 parents efe6a5b + 00b636f commit 3f358f9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div [class.d-none]="!availableFilters">
<div [class.d-none]="searchFilterCount === 0">
<h3>{{"search.filters.head" | translate}}</h3>
<div *ngIf="(filters | async)?.hasSucceeded">
<div #searchFilter *ngFor="let filter of (filters | async)?.payload; trackBy: trackUpdate">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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++;
}
});
}

Expand Down

0 comments on commit 3f358f9

Please sign in to comment.