Skip to content

Commit bfeeeac

Browse files
GauravD2ttdonohue
andauthored
only add Display Search Facets to the Homepage (DSpace#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 <tim.donohue@lyrasis.org>
1 parent fc4f0ec commit bfeeeac

18 files changed

Lines changed: 65 additions & 27 deletions

config/config.example.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ homePage:
294294
# No. of communities to list per page on the home page
295295
# 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
296296
pageSize: 5
297+
# Enable or disable the Discover filters on the homepage
298+
showDiscoverFilters: false
297299

298300
# Item Config
299301
item:

src/app/collection-page/collection-page.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@
5858
<ds-themed-loading *ngIf="collectionRD?.isLoading"
5959
message="{{'loading.collection' | translate}}"></ds-themed-loading>
6060
</div>
61-
</div>
61+
</div>

src/app/community-page/community-page.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Bitstream } from '../core/shared/bitstream.model';
77
import { Community } from '../core/shared/community.model';
88
import { fadeInOut } from '../shared/animations/fade';
99
import { hasValue } from '../shared/empty.util';
10-
import { getAllSucceededRemoteDataPayload} from '../core/shared/operators';
10+
import { getAllSucceededRemoteDataPayload } from '../core/shared/operators';
1111
import { AuthService } from '../core/auth/auth.service';
1212
import { AuthorizationDataService } from '../core/data/feature-authorization/authorization-data.service';
1313
import { FeatureID } from '../core/data/feature-authorization/feature-id';
Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
<ds-themed-home-news></ds-themed-home-news>
2-
<div class="container">
3-
<ng-container *ngIf="(site$ | async) as site">
4-
<ds-view-tracker [object]="site"></ds-view-tracker>
5-
</ng-container>
6-
<ds-themed-search-form [inPlaceSearch]="false" [searchPlaceholder]="'home.search-form.placeholder' | translate"></ds-themed-search-form>
7-
<ds-themed-top-level-community-list></ds-themed-top-level-community-list>
8-
<ds-recent-item-list *ngIf="recentSubmissionspageSize>0"></ds-recent-item-list>
2+
<div [ngClass]="appConfig.homePage.showDiscoverFilters ? 'container-fluid' : 'container'">
3+
<div class="row m-5">
4+
<div class="col-sm-3" *ngIf="appConfig.homePage.showDiscoverFilters">
5+
<ds-configuration-search-page [sideBarWidth]="12" [showViewModes]="false" [searchEnabled]="false"
6+
[inPlaceSearch]="false" [showScopeSelector]="false"></ds-configuration-search-page>
7+
</div>
8+
<div [ngClass]="appConfig.homePage.showDiscoverFilters ? 'col-sm-9' : 'col-sm-12'">
9+
<ng-container *ngIf="(site$ | async) as site">
10+
<ds-view-tracker [object]="site"></ds-view-tracker>
11+
</ng-container>
12+
<ds-themed-search-form [inPlaceSearch]="false"
13+
[searchPlaceholder]="'home.search-form.placeholder' | translate"></ds-themed-search-form>
14+
<ds-themed-top-level-community-list></ds-themed-top-level-community-list>
15+
<ds-recent-item-list *ngIf="recentSubmissionspageSize>0"></ds-recent-item-list>
16+
</div>
17+
</div>
918
</div>
1019
<ds-suggestions-popup></ds-suggestions-popup>

src/app/home-page/home-page.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { Component, OnInit } from '@angular/core';
1+
import { Component, Inject, OnInit } from '@angular/core';
22
import { map } from 'rxjs/operators';
33
import { ActivatedRoute } from '@angular/router';
44
import { Observable } from 'rxjs';
55
import { Site } from '../core/shared/site.model';
66
import { environment } from '../../environments/environment';
7+
import { APP_CONFIG, AppConfig } from 'src/config/app-config.interface';
78
@Component({
89
selector: 'ds-home-page',
910
styleUrls: ['./home-page.component.scss'],
@@ -14,6 +15,7 @@ export class HomePageComponent implements OnInit {
1415
site$: Observable<Site>;
1516
recentSubmissionspageSize: number;
1617
constructor(
18+
@Inject(APP_CONFIG) protected appConfig: AppConfig,
1719
private route: ActivatedRoute,
1820
) {
1921
this.recentSubmissionspageSize = environment.homePage.recentSubmissions.pageSize;

src/app/home-page/home-page.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { NgModule } from '@angular/core';
33
import { SharedModule } from '../shared/shared.module';
44
import { HomeNewsComponent } from './home-news/home-news.component';
55
import { HomePageRoutingModule } from './home-page-routing.module';
6-
76
import { HomePageComponent } from './home-page.component';
87
import { TopLevelCommunityListComponent } from './top-level-community-list/top-level-community-list.component';
98
import { StatisticsModule } from '../statistics/statistics.module';
@@ -13,6 +12,7 @@ import { RecentItemListComponent } from './recent-item-list/recent-item-list.com
1312
import { JournalEntitiesModule } from '../entity-groups/journal-entities/journal-entities.module';
1413
import { ResearchEntitiesModule } from '../entity-groups/research-entities/research-entities.module';
1514
import { ThemedTopLevelCommunityListComponent } from './top-level-community-list/themed-top-level-community-list.component';
15+
import { SearchModule } from '../shared/search/search.module';
1616
import { NotificationsModule } from '../notifications/notifications.module';
1717

1818
const DECLARATIONS = [
@@ -29,6 +29,7 @@ const DECLARATIONS = [
2929
imports: [
3030
CommonModule,
3131
SharedModule.withEntryComponents(),
32+
SearchModule,
3233
JournalEntitiesModule.withEntryComponents(),
3334
ResearchEntitiesModule.withEntryComponents(),
3435
HomePageRoutingModule,

src/app/shared/search/search-filters/search-filter/search-filter.component.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,20 @@ export class SearchFilterComponent implements OnInit {
157157
}
158158

159159
get regionId(): string {
160-
return `search-filter-region-${this.sequenceId}`;
160+
if (this.inPlaceSearch) {
161+
return `search-filter-region-${this.sequenceId}`;
162+
} else {
163+
return `search-filter-region-home-${this.sequenceId}`;
164+
}
165+
161166
}
162167

163168
get toggleId(): string {
164-
return `search-filter-toggle-${this.sequenceId}`;
169+
if (this.inPlaceSearch) {
170+
return `search-filter-toggle-${this.sequenceId}`;
171+
} else {
172+
return `search-filter-toggle-home-${this.sequenceId}`;
173+
}
165174
}
166175

167176
/**

src/app/shared/search/search-filters/search-filters.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<h3>{{"search.filters.head" | translate}}</h3>
1+
<h3 *ngIf="inPlaceSearch">{{filterLabel+'.filters.head' | translate}}</h3>
2+
<h2 *ngIf="!inPlaceSearch">{{filterLabel+'.filters.head' | translate}}</h2>
23
<div *ngIf="(filters | async)?.hasSucceeded">
34
<div *ngFor="let filter of (filters | async)?.payload; trackBy: trackUpdate">
45
<ds-search-filter [scope]="currentScope" [filter]="filter" [inPlaceSearch]="inPlaceSearch" [refreshFilters]="refreshFilters"></ds-search-filter>

src/app/shared/search/search-filters/search-filters.component.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ describe('SearchFiltersComponent', () => {
2020
getClearFiltersQueryParams: () => {
2121
},
2222
getSearchLink: () => {
23-
}
23+
},
24+
getConfigurationSearchConfig: () => { },
2425
/* eslint-enable no-empty, @typescript-eslint/no-empty-function */
2526
};
2627

src/app/shared/search/search-filters/search-filters.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export class SearchFiltersComponent implements OnInit, OnDestroy {
6161
searchLink: string;
6262

6363
subs = [];
64+
filterLabel = 'search';
6465

6566
/**
6667
* Initialize instance variables
@@ -77,6 +78,9 @@ export class SearchFiltersComponent implements OnInit, OnDestroy {
7778
}
7879

7980
ngOnInit(): void {
81+
if (!this.inPlaceSearch) {
82+
this.filterLabel = 'discover';
83+
}
8084
this.clearParams = this.searchConfigService.getCurrentFrontendFilters().pipe(map((filters) => {
8185
Object.keys(filters).forEach((f) => filters[f] = null);
8286
return filters;

0 commit comments

Comments
 (0)