From 961e15fe5f73e6aaffb1f0b841b60fc1c3147f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20G=C3=B3mez?= Date: Wed, 3 Jul 2024 23:13:13 +0200 Subject: [PATCH 01/15] Make the default tab for browsing communities and collections configurable --- config/config.example.yml | 8 ++++++++ .../collection-page/collection-page-routes.ts | 6 +++++- .../community-page/community-page-routes.ts | 6 +++++- .../comcol-page-browse-by.component.ts | 20 +++++++++++++++++-- src/assets/i18n/en.json5 | 4 ++++ src/assets/i18n/es.json5 | 6 ++++++ .../collection-page-config.interface.ts | 1 + src/config/community-page-config.interface.ts | 1 + src/config/default-app-config.ts | 2 ++ src/environments/environment.test.ts | 2 ++ 10 files changed, 52 insertions(+), 4 deletions(-) diff --git a/config/config.example.yml b/config/config.example.yml index 93386274e6..7695aed3a1 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -325,12 +325,20 @@ item: # Community Page Config community: + # Default tab to be shown when browsing a Community. Valid values are: comcols, search, or browse_ + # must be any of the configured "browse by" fields, e.g., dateissued, author, title, or subject + # When the default tab is not the 'search' tab, the search tab is moved to the last position + defaultBrowseTab: search # Search tab config searchSection: showSidebar: true # Collection Page Config collection: + # Default tab to be shown when browsing a Collection. Valid values are: search, or browse_ + # must be any of the configured "browse by" fields, e.g., dateissued, author, title, or subject + # When the default tab is not the 'search' tab, the search tab is moved to the last position + defaultBrowseTab: search # Search tab config searchSection: showSidebar: true diff --git a/src/app/collection-page/collection-page-routes.ts b/src/app/collection-page/collection-page-routes.ts index f2dadc3fbe..2e8f9e3f22 100644 --- a/src/app/collection-page/collection-page-routes.ts +++ b/src/app/collection-page/collection-page-routes.ts @@ -85,9 +85,13 @@ export const ROUTES: Route[] = [ component: ThemedCollectionPageComponent, children: [ { - path: '', + path: 'search', pathMatch: 'full', component: ComcolSearchSectionComponent, + resolve: { + breadcrumb: browseByI18nBreadcrumbResolver, + }, + data: { breadcrumbKey: 'collection.search' }, }, { path: 'browse/:id', diff --git a/src/app/community-page/community-page-routes.ts b/src/app/community-page/community-page-routes.ts index d9505c53b1..5ad9c3526e 100644 --- a/src/app/community-page/community-page-routes.ts +++ b/src/app/community-page/community-page-routes.ts @@ -72,9 +72,13 @@ export const ROUTES: Route[] = [ component: ThemedCommunityPageComponent, children: [ { - path: '', + path: 'search', pathMatch: 'full', component: ComcolSearchSectionComponent, + resolve: { + breadcrumb: i18nBreadcrumbResolver, + }, + data: { breadcrumbKey: 'community.search' }, }, { path: 'subcoms-cols', diff --git a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts index a7730ee7dd..a189cf2ddd 100644 --- a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts +++ b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts @@ -5,6 +5,7 @@ import { } from '@angular/common'; import { Component, + Inject, Input, OnDestroy, OnInit, @@ -33,6 +34,7 @@ import { take, } from 'rxjs/operators'; +import { APP_CONFIG, AppConfig } from '../../../../config/app-config.interface'; import { getCollectionPageRoute } from '../../../collection-page/collection-page-routing-paths'; import { getCommunityPageRoute } from '../../../community-page/community-page-routing-paths'; import { BrowseService } from '../../../core/browse/browse.service'; @@ -82,6 +84,7 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit { subs: Subscription[] = []; constructor( + @Inject(APP_CONFIG) public appConfig: AppConfig, public router: Router, private browseService: BrowseService, ) { @@ -99,14 +102,14 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit { allOptions.push({ id: 'search', label: 'collection.page.browse.search.head', - routerLink: comColRoute, + routerLink: `${comColRoute}/search`, }); } else if (this.contentType === 'community') { comColRoute = getCommunityPageRoute(this.id); allOptions.push({ id: 'search', label: 'collection.page.browse.search.head', - routerLink: comColRoute, + routerLink: `${comColRoute}/search`, }); allOptions.push({ id: 'comcols', @@ -120,6 +123,10 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit { label: `browse.comcol.by.${config.id}`, routerLink: `${comColRoute}/browse/${config.id}`, }))); + + if (this.appConfig[this.contentType].defaultBrowseTab !== 'search') { + allOptions.push(allOptions.shift()) + } } return allOptions; }), @@ -140,6 +147,15 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit { } } })); + + this.allOptions$.pipe( + take(1), + ).subscribe((allOptions: ComColPageNavOption[]) => { + if (!allOptions.find(o => o.routerLink === this.router.url?.split('?')[0])) { + var option = allOptions.find(o => o.id === this.appConfig[this.contentType].defaultBrowseTab); + void this.router.navigate([option.routerLink], { queryParams: option.params }); + } + }); } ngOnDestroy(): void { diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 8f20c657f9..78be56caa1 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -1324,6 +1324,8 @@ "collection.page.news": "News", + "collection.search.breadcrumbs": "Search", + "collection.search.results.head": "Search Results", "collection.select.confirm": "Confirm selected", @@ -1562,6 +1564,8 @@ "community.all-lists.head": "Subcommunities and Collections", + "community.search.breadcrumbs": "Search", + "community.search.results.head": "Search Results", "community.sub-collection-list.head": "Collections in this Community", diff --git a/src/assets/i18n/es.json5 b/src/assets/i18n/es.json5 index 55962d25b5..e359d60523 100644 --- a/src/assets/i18n/es.json5 +++ b/src/assets/i18n/es.json5 @@ -1929,6 +1929,9 @@ // "collection.page.news": "News", "collection.page.news": "Noticias", + // "collection.search.breadcrumbs": "Search", + "collection.search.breadcrumbs": "Buscar", + // "collection.select.confirm": "Confirm selected", "collection.select.confirm": "Confirmar seleccionado", @@ -2250,6 +2253,9 @@ // "community.all-lists.head": "Subcommunities and Collections", "community.all-lists.head": "Subcomunidades y colecciones", + // "community.search.breadcrumbs": "Search", + "community.search.breadcrumbs": "Buscar", + // "community.sub-collection-list.head": "Collections in this Community", "community.sub-collection-list.head": "Colecciones de esta comunidad", diff --git a/src/config/collection-page-config.interface.ts b/src/config/collection-page-config.interface.ts index 6b8352e686..5aec06daea 100644 --- a/src/config/collection-page-config.interface.ts +++ b/src/config/collection-page-config.interface.ts @@ -4,6 +4,7 @@ import { Config } from './config.interface'; * Collection Page Config */ export interface CollectionPageConfig extends Config { + defaultBrowseTab: string; searchSection: CollectionSearchSectionConfig; edit: { undoTimeout: number; diff --git a/src/config/community-page-config.interface.ts b/src/config/community-page-config.interface.ts index 268f4d6a5e..72b859bffc 100644 --- a/src/config/community-page-config.interface.ts +++ b/src/config/community-page-config.interface.ts @@ -4,6 +4,7 @@ import { Config } from './config.interface'; * Community Page Config */ export interface CommunityPageConfig extends Config { + defaultBrowseTab: string; searchSection: CommunitySearchSectionConfig; } diff --git a/src/config/default-app-config.ts b/src/config/default-app-config.ts index 3682d095cd..ffa24cee2b 100644 --- a/src/config/default-app-config.ts +++ b/src/config/default-app-config.ts @@ -333,6 +333,7 @@ export class DefaultAppConfig implements AppConfig { // Community Page Config community: CommunityPageConfig = { + defaultBrowseTab: 'search', searchSection: { showSidebar: true, }, @@ -340,6 +341,7 @@ export class DefaultAppConfig implements AppConfig { // Collection Page Config collection: CollectionPageConfig = { + defaultBrowseTab: 'search', searchSection: { showSidebar: true, }, diff --git a/src/environments/environment.test.ts b/src/environments/environment.test.ts index cd02e35fb1..ceaf40ca0a 100644 --- a/src/environments/environment.test.ts +++ b/src/environments/environment.test.ts @@ -267,11 +267,13 @@ export const environment: BuildConfig = { }, }, community: { + defaultBrowseTab: 'search', searchSection: { showSidebar: true, }, }, collection: { + defaultBrowseTab: 'search', searchSection: { showSidebar: true, }, From 33764f4caa2014dbcf9c09af630b96e26e21592a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20G=C3=B3mez?= Date: Wed, 3 Jul 2024 23:54:58 +0200 Subject: [PATCH 02/15] Minor fixes to avoid lint errors --- .../comcol-page-browse-by.component.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts index a189cf2ddd..3fcdf8b8c5 100644 --- a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts +++ b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts @@ -34,7 +34,10 @@ import { take, } from 'rxjs/operators'; -import { APP_CONFIG, AppConfig } from '../../../../config/app-config.interface'; +import { + APP_CONFIG, + AppConfig +} from '../../../../config/app-config.interface'; import { getCollectionPageRoute } from '../../../collection-page/collection-page-routing-paths'; import { getCommunityPageRoute } from '../../../community-page/community-page-routing-paths'; import { BrowseService } from '../../../core/browse/browse.service'; @@ -125,7 +128,7 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit { }))); if (this.appConfig[this.contentType].defaultBrowseTab !== 'search') { - allOptions.push(allOptions.shift()) + allOptions.push(allOptions.shift()); } } return allOptions; @@ -152,7 +155,7 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit { take(1), ).subscribe((allOptions: ComColPageNavOption[]) => { if (!allOptions.find(o => o.routerLink === this.router.url?.split('?')[0])) { - var option = allOptions.find(o => o.id === this.appConfig[this.contentType].defaultBrowseTab); + const option = allOptions.find(o => o.id === this.appConfig[this.contentType].defaultBrowseTab); void this.router.navigate([option.routerLink], { queryParams: option.params }); } }); From b7f3711de1b9e49f2e43f3873019eea02e4642f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20G=C3=B3mez?= Date: Thu, 4 Jul 2024 00:04:40 +0200 Subject: [PATCH 03/15] Other minor lint fixes --- .../comcol-page-browse-by/comcol-page-browse-by.component.ts | 2 +- src/assets/i18n/en.json5 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts index 3fcdf8b8c5..f740722eed 100644 --- a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts +++ b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts @@ -36,7 +36,7 @@ import { import { APP_CONFIG, - AppConfig + AppConfig, } from '../../../../config/app-config.interface'; import { getCollectionPageRoute } from '../../../collection-page/collection-page-routing-paths'; import { getCommunityPageRoute } from '../../../community-page/community-page-routing-paths'; diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 78be56caa1..a697fa77c8 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -1565,7 +1565,7 @@ "community.all-lists.head": "Subcommunities and Collections", "community.search.breadcrumbs": "Search", - + "community.search.results.head": "Search Results", "community.sub-collection-list.head": "Collections in this Community", From b49216c173d1a25b6aacf21c8d7f4c7cb58ea3b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20G=C3=B3mez?= Date: Thu, 4 Jul 2024 00:11:30 +0200 Subject: [PATCH 04/15] Fix trailing spaces --- .../comcol-page-browse-by/comcol-page-browse-by.component.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts index f740722eed..a639737c7c 100644 --- a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts +++ b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts @@ -33,8 +33,7 @@ import { startWith, take, } from 'rxjs/operators'; - -import { +import { APP_CONFIG, AppConfig, } from '../../../../config/app-config.interface'; From 6cecd0abbe09c648889c95f9c1e54baba7f9439d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20G=C3=B3mez?= Date: Thu, 4 Jul 2024 00:48:04 +0200 Subject: [PATCH 05/15] Fix imports --- .../comcol-page-browse-by/comcol-page-browse-by.component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts index a639737c7c..8f4b1268f8 100644 --- a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts +++ b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts @@ -33,6 +33,7 @@ import { startWith, take, } from 'rxjs/operators'; + import { APP_CONFIG, AppConfig, From 531d3286632cb56a1dc409b2ab3e48d276b17805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20G=C3=B3mez?= Date: Thu, 4 Jul 2024 05:35:36 +0200 Subject: [PATCH 06/15] Fix resolving the wrong segment of the route in the comcol search component --- .../comcol-search-section/comcol-search-section.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.ts b/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.ts index 1672ad169f..d0f88ae54e 100644 --- a/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.ts +++ b/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.ts @@ -55,7 +55,7 @@ export class ComcolSearchSectionComponent implements OnInit { } ngOnInit(): void { - this.comcol$ = this.route.data.pipe( + this.comcol$ = this.route.parent.data.pipe( map((data: Data) => (data.dso as RemoteData).payload), ); this.showSidebar$ = this.comcol$.pipe( From 6306776f8b63323822707ef76b73dbd7b1530807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20G=C3=B3mez?= Date: Thu, 4 Jul 2024 05:54:45 +0200 Subject: [PATCH 07/15] Simplify code detecting a navigation to the default route --- .../comcol-page-browse-by.component.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts index 8f4b1268f8..b0a3eafeb7 100644 --- a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts +++ b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts @@ -145,20 +145,14 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit { ), ]).subscribe(([navOptions, url]: [ComColPageNavOption[], string]) => { for (const option of navOptions) { - if (option.routerLink === url?.split('?')[0]) { + if (url?.split('?')[0].endsWith(`/${this.id}`)) { + const option = navOptions.find(o => o.id === this.appConfig[this.contentType].defaultBrowseTab); + void this.router.navigate([option.routerLink], { queryParams: option.params }); + } else if (option.routerLink === url?.split('?')[0]) { this.currentOption$.next(option); } } })); - - this.allOptions$.pipe( - take(1), - ).subscribe((allOptions: ComColPageNavOption[]) => { - if (!allOptions.find(o => o.routerLink === this.router.url?.split('?')[0])) { - const option = allOptions.find(o => o.id === this.appConfig[this.contentType].defaultBrowseTab); - void this.router.navigate([option.routerLink], { queryParams: option.params }); - } - }); } ngOnDestroy(): void { From 4de99ba19d51b3bdc57fbf93c0853bc0b8f33b5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20G=C3=B3mez?= Date: Thu, 4 Jul 2024 06:02:31 +0200 Subject: [PATCH 08/15] Refactor condition --- .../comcol-page-browse-by.component.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts index b0a3eafeb7..2a2489de05 100644 --- a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts +++ b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts @@ -144,12 +144,14 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit { distinctUntilChanged(), ), ]).subscribe(([navOptions, url]: [ComColPageNavOption[], string]) => { - for (const option of navOptions) { - if (url?.split('?')[0].endsWith(`/${this.id}`)) { - const option = navOptions.find(o => o.id === this.appConfig[this.contentType].defaultBrowseTab); - void this.router.navigate([option.routerLink], { queryParams: option.params }); - } else if (option.routerLink === url?.split('?')[0]) { - this.currentOption$.next(option); + if (url?.split('?')[0].endsWith(`/${this.id}`)) { + const option = navOptions.find(o => o.id === this.appConfig[this.contentType].defaultBrowseTab); + void this.router.navigate([option.routerLink], { queryParams: option.params }); + } else { + for (const option of navOptions) { + if (option.routerLink === url?.split('?')[0]) { + this.currentOption$.next(option); + } } } })); From 583dc1f3682ccdf68854e3d777554683660dca51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20G=C3=B3mez?= Date: Thu, 4 Jul 2024 17:24:27 +0200 Subject: [PATCH 09/15] Fix SubComColSectionComponent test --- .../comcol-search-section.component.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.spec.ts b/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.spec.ts index 48ad8e1c04..f887d1d524 100644 --- a/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.spec.ts +++ b/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.spec.ts @@ -18,6 +18,7 @@ describe('ComcolSearchSectionComponent', () => { beforeEach(async () => { route = new ActivatedRouteStub(); + route.parent = new ActivatedRouteStub(); await TestBed.configureTestingModule({ imports: [ComcolSearchSectionComponent], From c212b3dccd6f7c304e0c087047924f81696be16e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20G=C3=B3mez?= Date: Thu, 13 Mar 2025 22:43:51 +0100 Subject: [PATCH 10/15] Add default route for when no page reaload is performed --- src/app/collection-page/collection-page-routes.ts | 7 ++++++- src/app/community-page/community-page-routes.ts | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app/collection-page/collection-page-routes.ts b/src/app/collection-page/collection-page-routes.ts index 673ee07fa8..2606293bfd 100644 --- a/src/app/collection-page/collection-page-routes.ts +++ b/src/app/collection-page/collection-page-routes.ts @@ -86,12 +86,17 @@ export const ROUTES: Route[] = [ menu: dsoEditMenuResolver, }, children: [ + { + path: '', + pathMatch: 'full', + component: ComcolSearchSectionComponent, + }, { path: 'search', pathMatch: 'full', component: ComcolSearchSectionComponent, resolve: { - breadcrumb: browseByI18nBreadcrumbResolver, + breadcrumb: i18nBreadcrumbResolver, }, data: { breadcrumbKey: 'collection.search' }, }, diff --git a/src/app/community-page/community-page-routes.ts b/src/app/community-page/community-page-routes.ts index ca5e14209e..5b2a8f8133 100644 --- a/src/app/community-page/community-page-routes.ts +++ b/src/app/community-page/community-page-routes.ts @@ -73,6 +73,11 @@ export const ROUTES: Route[] = [ menu: dsoEditMenuResolver, }, children: [ + { + path: '', + pathMatch: 'full', + component: ComcolSearchSectionComponent, + }, { path: 'search', pathMatch: 'full', From 262f758699e743bb83661b8f5daac6e3abaaf81f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20G=C3=B3mez?= Date: Thu, 13 Mar 2025 22:44:32 +0100 Subject: [PATCH 11/15] Simplify page redirection when the default route is used --- .../comcol-page-browse-by.component.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts index c5f3a614f8..550dab51df 100644 --- a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts +++ b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts @@ -121,6 +121,8 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit { routerLink: `${comColRoute}/browse/${config.id}`, }))); + // When the default tab is not the "search" tab, the "search" tab is moved + // at the end of the tabs ribbon for aesthetics purposes. if (this.appConfig[this.contentType].defaultBrowseTab !== 'search') { allOptions.push(allOptions.shift()); } @@ -138,17 +140,16 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit { distinctUntilChanged(), ), ]).subscribe(([navOptions, url]: [ComColPageNavOption[], string]) => { - if (url?.split('?')[0].endsWith(`/${this.id}`)) { - const option = navOptions.find(o => o.id === this.appConfig[this.contentType].defaultBrowseTab); - void this.router.navigate([option.routerLink], { queryParams: option.params }); - } else { - for (const option of navOptions) { - if (option.routerLink === url?.split('?')[0]) { - this.currentOption$.next(option); - } + for (const option of navOptions) { + if (option.routerLink === url?.split('?')[0]) { + this.currentOption$.next(option); } } })); + + if (this.router.url?.split('?')[0].endsWith(`/${this.id}`)) { + void this.router.navigate([this.router.url, this.appConfig[this.contentType].defaultBrowseTab]); + } } ngOnDestroy(): void { From 5d4006f7533968c1b4fa0e24e41a2aba7bdec523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20G=C3=B3mez?= Date: Thu, 13 Mar 2025 23:38:56 +0100 Subject: [PATCH 12/15] Rework redirection using allOptions --- .../comcol-page-browse-by.component.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts index 550dab51df..da6c54e13a 100644 --- a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts +++ b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts @@ -148,7 +148,17 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit { })); if (this.router.url?.split('?')[0].endsWith(`/${this.id}`)) { - void this.router.navigate([this.router.url, this.appConfig[this.contentType].defaultBrowseTab]); + this.allOptions$.pipe( + take(1), + ).subscribe((allOptions: ComColPageNavOption[]) => { + for (const option of allOptions) { + if (option.id === this.appConfig[this.contentType].defaultBrowseTab) { + this.currentOption$.next(option[0]); + void this.router.navigate([option.routerLink], { queryParams: option.params }); + break; + } + } + }); } } From 53562e5a3eb853c7ce16cdfad5ffe12a7ed41b01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20G=C3=B3mez?= Date: Fri, 14 Mar 2025 00:07:26 +0100 Subject: [PATCH 13/15] Also load the default tab when navigating using the breadcrumbs --- .../comcol-page-browse-by/comcol-page-browse-by.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts index da6c54e13a..feefb468cb 100644 --- a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts +++ b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts @@ -141,7 +141,9 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit { ), ]).subscribe(([navOptions, url]: [ComColPageNavOption[], string]) => { for (const option of navOptions) { - if (option.routerLink === url?.split('?')[0]) { + if (url?.split('?')[0].endsWith(`/${this.id}`) && option.id === this.appConfig[this.contentType].defaultBrowseTab) { + void this.router.navigate([option.routerLink], { queryParams: option.params }); + } else if (option.routerLink === url?.split('?')[0]) { this.currentOption$.next(option); } } From 30b411285c4bf2220536657a50dfaa9cbae52f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20G=C3=B3mez?= Date: Fri, 14 Mar 2025 00:18:38 +0100 Subject: [PATCH 14/15] Fix missing keys in language file --- src/assets/i18n/es.json5 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/assets/i18n/es.json5 b/src/assets/i18n/es.json5 index 936775854b..c67bed6a4d 100644 --- a/src/assets/i18n/es.json5 +++ b/src/assets/i18n/es.json5 @@ -1988,6 +1988,9 @@ // "collection.page.news": "News", "collection.page.news": "Noticias", + // "collection.search.results.head": "Search Results", + "collection.search.results.head": "Resultados de la búsqueda", + // "collection.select.confirm": "Confirm selected", "collection.select.confirm": "Confirmar seleccionado", @@ -2342,6 +2345,9 @@ // "community.all-lists.head": "Subcommunities and Collections", "community.all-lists.head": "Subcomunidades y colecciones", + // "community.search.results.head": "Search Results", + "community.search.results.head": "Resultados de la búsqueda", + // "community.sub-collection-list.head": "Collections in this Community", "community.sub-collection-list.head": "Colecciones de esta comunidad", From 422a714935f6ff8487ef8e68f143b6dee6bd715a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20G=C3=B3mez?= Date: Fri, 14 Mar 2025 01:01:52 +0100 Subject: [PATCH 15/15] Check the full URL rather than only the collection id to detect the default path --- .../comcol-page-browse-by.component.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts index feefb468cb..5b8f12a75d 100644 --- a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts +++ b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts @@ -131,6 +131,13 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit { }), ); + let comColRoute: string; + if (this.contentType === 'collection') { + comColRoute = getCollectionPageRoute(this.id); + } else if (this.contentType === 'community') { + comColRoute = getCommunityPageRoute(this.id); + } + this.subs.push(combineLatest([ this.allOptions$, this.router.events.pipe( @@ -141,15 +148,17 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit { ), ]).subscribe(([navOptions, url]: [ComColPageNavOption[], string]) => { for (const option of navOptions) { - if (url?.split('?')[0].endsWith(`/${this.id}`) && option.id === this.appConfig[this.contentType].defaultBrowseTab) { + if (url?.split('?')[0] === comColRoute && option.id === this.appConfig[this.contentType].defaultBrowseTab) { void this.router.navigate([option.routerLink], { queryParams: option.params }); + break; } else if (option.routerLink === url?.split('?')[0]) { this.currentOption$.next(option); + break; } } })); - if (this.router.url?.split('?')[0].endsWith(`/${this.id}`)) { + if (this.router.url?.split('?')[0] === comColRoute) { this.allOptions$.pipe( take(1), ).subscribe((allOptions: ComColPageNavOption[]) => {