From bfeeeac96f52b6eddab360778a5f22e84693db70 Mon Sep 17 00:00:00 2001 From: gaurav patel <100828173+GauravD2t@users.noreply.github.com> Date: Sat, 24 Feb 2024 03:31:36 +0530 Subject: [PATCH] only add Display Search Facets to the Homepage (#2275) * Update homepage-config.interface.ts change comment of homepage-config.interface.ts * advance Search add * slove error while unti test * write unit test * Ensures select element has an accessible name * change data pass into url * error resolve * Search.Filters.Applied.F.Title given name as Title * Advanced filters configurable in the User interface (in config.*.yml) * Search Facets on all Home, Community, Collection * should pass accessibility tests error resolve * change label name * unique role or role/label/title * remove same role name * order of headings is semantically correct * semantically correct advance search and global css * URL pattern * headings is semantically correct * Merge branch 'Search-Facets-home-community-collection' of https://github.com/GauravD2t/Advanced-search into Search-Facets-home-community-collection * change update * change update * remove advance search code from here * removing all code relating to Community/Collection pages * resolve code conflict * remove the space * remove commented code * add 'merge' * resolve confilt * remove back file * add lable dynamic * Update search-navbar.component.spec.ts * Update search-filter.component.html * showDiscoverFilters config in yml file * Ensures the order of headings is semantically correct * showDiscoverFilters change default to false * Update homepage-config.interface.ts to use boolean instead of false --------- Co-authored-by: Tim Donohue --- config/config.example.yml | 2 ++ .../collection-page.component.html | 2 +- .../community-page.component.ts | 2 +- src/app/home-page/home-page.component.html | 23 +++++++++++++------ src/app/home-page/home-page.component.ts | 4 +++- src/app/home-page/home-page.module.ts | 3 ++- .../search-filter/search-filter.component.ts | 13 +++++++++-- .../search-filters.component.html | 3 ++- .../search-filters.component.spec.ts | 3 ++- .../search-filters.component.ts | 4 ++++ .../search-sidebar.component.html | 2 +- src/app/shared/search/search.component.html | 13 ++++++----- src/app/shared/search/search.module.ts | 1 - .../sidebar/sidebar-dropdown.component.html | 2 +- src/assets/i18n/en.json5 | 3 +++ src/config/default-app-config.ts | 3 ++- src/config/homepage-config.interface.ts | 6 ++++- src/environments/environment.test.ts | 3 ++- 18 files changed, 65 insertions(+), 27 deletions(-) diff --git a/config/config.example.yml b/config/config.example.yml index feea06f7cb5..4fbc98fea2c 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -294,6 +294,8 @@ homePage: # No. of communities to list per page on the home page # This will always round to the nearest number from the list of page sizes. e.g. if you set it to 7 it'll use 10 pageSize: 5 + # Enable or disable the Discover filters on the homepage + showDiscoverFilters: false # Item Config item: diff --git a/src/app/collection-page/collection-page.component.html b/src/app/collection-page/collection-page.component.html index 21cc94af68d..d5da37c12f7 100644 --- a/src/app/collection-page/collection-page.component.html +++ b/src/app/collection-page/collection-page.component.html @@ -58,4 +58,4 @@ - + \ No newline at end of file diff --git a/src/app/community-page/community-page.component.ts b/src/app/community-page/community-page.component.ts index 206aa54cb07..148df025091 100644 --- a/src/app/community-page/community-page.component.ts +++ b/src/app/community-page/community-page.component.ts @@ -7,7 +7,7 @@ import { Bitstream } from '../core/shared/bitstream.model'; import { Community } from '../core/shared/community.model'; import { fadeInOut } from '../shared/animations/fade'; import { hasValue } from '../shared/empty.util'; -import { getAllSucceededRemoteDataPayload} from '../core/shared/operators'; +import { getAllSucceededRemoteDataPayload } from '../core/shared/operators'; import { AuthService } from '../core/auth/auth.service'; import { AuthorizationDataService } from '../core/data/feature-authorization/authorization-data.service'; import { FeatureID } from '../core/data/feature-authorization/feature-id'; diff --git a/src/app/home-page/home-page.component.html b/src/app/home-page/home-page.component.html index 49329b3f044..c1d4b8a98c7 100644 --- a/src/app/home-page/home-page.component.html +++ b/src/app/home-page/home-page.component.html @@ -1,10 +1,19 @@ -
- - - - - - +
+
+
+ +
+
+ + + + + + +
+
diff --git a/src/app/home-page/home-page.component.ts b/src/app/home-page/home-page.component.ts index c151cbbb164..9adc478b908 100644 --- a/src/app/home-page/home-page.component.ts +++ b/src/app/home-page/home-page.component.ts @@ -1,9 +1,10 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, Inject, OnInit } from '@angular/core'; import { map } from 'rxjs/operators'; import { ActivatedRoute } from '@angular/router'; import { Observable } from 'rxjs'; import { Site } from '../core/shared/site.model'; import { environment } from '../../environments/environment'; +import { APP_CONFIG, AppConfig } from 'src/config/app-config.interface'; @Component({ selector: 'ds-home-page', styleUrls: ['./home-page.component.scss'], @@ -14,6 +15,7 @@ export class HomePageComponent implements OnInit { site$: Observable; recentSubmissionspageSize: number; constructor( + @Inject(APP_CONFIG) protected appConfig: AppConfig, private route: ActivatedRoute, ) { this.recentSubmissionspageSize = environment.homePage.recentSubmissions.pageSize; diff --git a/src/app/home-page/home-page.module.ts b/src/app/home-page/home-page.module.ts index 7b656abd735..e3debef5caf 100644 --- a/src/app/home-page/home-page.module.ts +++ b/src/app/home-page/home-page.module.ts @@ -3,7 +3,6 @@ import { NgModule } from '@angular/core'; import { SharedModule } from '../shared/shared.module'; import { HomeNewsComponent } from './home-news/home-news.component'; import { HomePageRoutingModule } from './home-page-routing.module'; - import { HomePageComponent } from './home-page.component'; import { TopLevelCommunityListComponent } from './top-level-community-list/top-level-community-list.component'; import { StatisticsModule } from '../statistics/statistics.module'; @@ -13,6 +12,7 @@ import { RecentItemListComponent } from './recent-item-list/recent-item-list.com import { JournalEntitiesModule } from '../entity-groups/journal-entities/journal-entities.module'; import { ResearchEntitiesModule } from '../entity-groups/research-entities/research-entities.module'; import { ThemedTopLevelCommunityListComponent } from './top-level-community-list/themed-top-level-community-list.component'; +import { SearchModule } from '../shared/search/search.module'; import { NotificationsModule } from '../notifications/notifications.module'; const DECLARATIONS = [ @@ -29,6 +29,7 @@ const DECLARATIONS = [ imports: [ CommonModule, SharedModule.withEntryComponents(), + SearchModule, JournalEntitiesModule.withEntryComponents(), ResearchEntitiesModule.withEntryComponents(), HomePageRoutingModule, diff --git a/src/app/shared/search/search-filters/search-filter/search-filter.component.ts b/src/app/shared/search/search-filters/search-filter/search-filter.component.ts index 67e8906bb5d..64b5ba23e23 100644 --- a/src/app/shared/search/search-filters/search-filter/search-filter.component.ts +++ b/src/app/shared/search/search-filters/search-filter/search-filter.component.ts @@ -157,11 +157,20 @@ export class SearchFilterComponent implements OnInit { } get regionId(): string { - return `search-filter-region-${this.sequenceId}`; + if (this.inPlaceSearch) { + return `search-filter-region-${this.sequenceId}`; + } else { + return `search-filter-region-home-${this.sequenceId}`; + } + } get toggleId(): string { - return `search-filter-toggle-${this.sequenceId}`; + if (this.inPlaceSearch) { + return `search-filter-toggle-${this.sequenceId}`; + } else { + return `search-filter-toggle-home-${this.sequenceId}`; + } } /** 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 c006d80c44f..b5377f502ba 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,5 @@ -

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

+

{{filterLabel+'.filters.head' | translate}}

+

{{filterLabel+'.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 522459b603a..85fd8e09a12 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 @@ -20,7 +20,8 @@ describe('SearchFiltersComponent', () => { getClearFiltersQueryParams: () => { }, getSearchLink: () => { - } + }, + getConfigurationSearchConfig: () => { }, /* eslint-enable no-empty, @typescript-eslint/no-empty-function */ }; 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 766939226dd..57cce617888 100644 --- a/src/app/shared/search/search-filters/search-filters.component.ts +++ b/src/app/shared/search/search-filters/search-filters.component.ts @@ -61,6 +61,7 @@ export class SearchFiltersComponent implements OnInit, OnDestroy { searchLink: string; subs = []; + filterLabel = 'search'; /** * Initialize instance variables @@ -77,6 +78,9 @@ export class SearchFiltersComponent implements OnInit, OnDestroy { } ngOnInit(): void { + if (!this.inPlaceSearch) { + this.filterLabel = 'discover'; + } this.clearParams = this.searchConfigService.getCurrentFrontendFilters().pipe(map((filters) => { Object.keys(filters).forEach((f) => filters[f] = null); return filters; diff --git a/src/app/shared/search/search-sidebar/search-sidebar.component.html b/src/app/shared/search/search-sidebar/search-sidebar.component.html index 529f1de8870..f14854593e0 100644 --- a/src/app/shared/search/search-sidebar/search-sidebar.component.html +++ b/src/app/shared/search/search-sidebar/search-sidebar.component.html @@ -23,7 +23,7 @@ [filters]="filters" [refreshFilters]="refreshFilters" [inPlaceSearch]="inPlaceSearch"> -
diff --git a/src/app/shared/search/search.component.html b/src/app/shared/search/search.component.html index acd60f2616b..6ee0bb3cb07 100644 --- a/src/app/shared/search/search.component.html +++ b/src/app/shared/search/search.component.html @@ -10,8 +10,9 @@
- - + + @@ -22,15 +23,15 @@
- -
- -
+ \ No newline at end of file diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index a8632ee9996..57ed7d30671 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -5630,6 +5630,8 @@ "admin.system-wide-alert.title": "System-wide Alerts", + "discover.filters.head": "Discover", + "item-access-control-title": "This form allows you to perform changes to the access conditions of the item's metadata or its bitstreams.", "collection-access-control-title": "This form allows you to perform changes to the access conditions of all the items owned by this collection. Changes may be performed to either all Item metadata or all content (bitstreams).", @@ -5698,3 +5700,4 @@ "admin.notifications.publicationclaim.page.title": "Publication Claim", } + diff --git a/src/config/default-app-config.ts b/src/config/default-app-config.ts index b7c026be899..ae5c6c1d00c 100644 --- a/src/config/default-app-config.ts +++ b/src/config/default-app-config.ts @@ -306,7 +306,8 @@ export class DefaultAppConfig implements AppConfig { }, topLevelCommunityList: { pageSize: 5 - } + }, + showDiscoverFilters: false }; // Item Config diff --git a/src/config/homepage-config.interface.ts b/src/config/homepage-config.interface.ts index df5d29cfe03..48fd9077a92 100644 --- a/src/config/homepage-config.interface.ts +++ b/src/config/homepage-config.interface.ts @@ -1,7 +1,7 @@ import { Config } from './config.interface'; /** - * Config that determines how the dropdown list of years are created for browse-by-date components + * Config that determines how the recentSubmissions list showing at home page */ export interface HomeConfig extends Config { recentSubmissions: { @@ -19,4 +19,8 @@ export interface HomeConfig extends Config { topLevelCommunityList: { pageSize: number; }; + /* + * Enable or disable the Discover filters on the homepage + */ + showDiscoverFilters: boolean; } diff --git a/src/environments/environment.test.ts b/src/environments/environment.test.ts index 7324cf4d13c..e0cf1eb2072 100644 --- a/src/environments/environment.test.ts +++ b/src/environments/environment.test.ts @@ -246,7 +246,8 @@ export const environment: BuildConfig = { }, topLevelCommunityList: { pageSize: 5 - } + }, + showDiscoverFilters: false }, item: { edit: {