Skip to content

Commit b19be46

Browse files
[Duracom-508] port comm/coll menu config
1 parent 6a4efac commit b19be46

6 files changed

Lines changed: 37 additions & 1 deletion

File tree

config/config.example.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,8 @@ homePage:
403403
pageSize: 5
404404
# Enable or disable the Discover filters on the homepage
405405
showDiscoverFilters: false
406+
# Enable or disable the dynamic layout configuration on the homepage
407+
enableDynamicLayout: true
406408

407409
# Item Config
408410
item:
@@ -756,6 +758,11 @@ layout:
756758
type: attribute
757759
- name: checksum
758760
type: attribute
761+
# Navbar layout configuration
762+
navbar:
763+
# If true, show the "Community and Collections" link in the navbar; otherwise, show it in the admin sidebar
764+
showCommunityCollection: true
765+
759766

760767
# Configuration for customization of search results
761768
searchResults:

src/app/shared/menu/providers/community-list.menu.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
import { TestBed } from '@angular/core/testing';
10+
import { APP_CONFIG } from '@dspace/config/app-config.interface';
1011

1112
import { MenuItemType } from '../menu-item-type.model';
1213
import { PartialMenuSection } from '../menu-provider.model';
@@ -31,6 +32,7 @@ describe('CommunityListMenuProvider', () => {
3132
TestBed.configureTestingModule({
3233
providers: [
3334
CommunityListMenuProvider,
35+
{ provide: APP_CONFIG, useValue: { layout: { navbar: { showCommunityCollection: true } } } },
3436
],
3537
});
3638
provider = TestBed.inject(CommunityListMenuProvider);

src/app/shared/menu/providers/community-list.menu.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
* http://www.dspace.org/license/
77
*/
88

9-
import { Injectable } from '@angular/core';
9+
import {
10+
inject,
11+
Injectable,
12+
} from '@angular/core';
13+
import { APP_CONFIG } from '@dspace/config/app-config.interface';
1014
import {
1115
Observable,
1216
of,
@@ -23,7 +27,12 @@ import {
2327
*/
2428
@Injectable()
2529
export class CommunityListMenuProvider extends AbstractMenuProvider {
30+
protected appConfig = inject(APP_CONFIG);
31+
2632
public getSections(): Observable<PartialMenuSection[]> {
33+
if (!this.appConfig.layout.navbar.showCommunityCollection) {
34+
return of([]);
35+
}
2736
return of([
2837
{
2938
visible: true,

src/config/default-app-config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,10 @@ export class DefaultAppConfig implements AppConfig {
816816
},
817817
],
818818
},
819+
navbar: {
820+
// If true, show the "Community and Collections" link in the navbar; otherwise, show it in the admin sidebar
821+
showCommunityCollection: true,
822+
},
819823
};
820824

821825
// Search result configuration for authority metadata processing

src/config/layout-config.interfaces.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,15 @@ export interface LayoutConfig extends Config {
7676
* Controls pagination and metadata display for bitstream attachments.
7777
*/
7878
advancedAttachmentRendering: AdvancedAttachmentRenderingConfig;
79+
/**
80+
* Configuration for the navbar layout customization.
81+
*/
82+
navbar: NavbarConfig;
83+
}
84+
85+
/**
86+
* Interface describing the structure of the navbar layout.
87+
*/
88+
export interface NavbarConfig extends Config {
89+
showCommunityCollection: boolean;
7990
}

src/environments/environment.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,9 @@ export const environment: BuildConfig = {
604604
},
605605
],
606606
},
607+
navbar: {
608+
showCommunityCollection: true,
609+
},
607610
},
608611

609612
searchResult: {

0 commit comments

Comments
 (0)