Skip to content

Commit 3e803e8

Browse files
committed
Make no. of communities per pagination / expansion configurable
Adds new config settings for no. of communities to display on the home page & community-list page. Resolves DSpace#1749, resolves DSpace#1750
1 parent 31167a3 commit 3e803e8

7 files changed

Lines changed: 30 additions & 2 deletions

File tree

config/config.example.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ browseBy:
175175
# The absolute lowest year to display in the dropdown (only used when no lowest date can be found for all items)
176176
defaultLowerLimit: 1900
177177

178+
browseCommunities:
179+
communityListPageSize: 20
180+
topLevelPageSize: 5
181+
178182
# Item Config
179183
item:
180184
edit:

src/app/community-list-page/community-list-service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { followLink } from '../shared/utils/follow-link-config.model';
2323
import { FlatNode } from './flat-node.model';
2424
import { ShowMoreFlatNode } from './show-more-flat-node.model';
2525
import { FindListOptions } from '../core/data/find-list-options.model';
26+
import { environment } from 'src/environments/environment';
2627

2728
// Helper method to combine an flatten an array of observables of flatNode arrays
2829
export const combineAndFlatten = (obsList: Observable<FlatNode[]>[]): Observable<FlatNode[]> =>
@@ -80,7 +81,7 @@ const communityListStateSelector = (state: AppState) => state.communityList;
8081
const expandedNodesSelector = createSelector(communityListStateSelector, (communityList: CommunityListState) => communityList.expandedNodes);
8182
const loadingNodeSelector = createSelector(communityListStateSelector, (communityList: CommunityListState) => communityList.loadingNode);
8283

83-
export const MAX_COMCOLS_PER_PAGE = 20;
84+
export const MAX_COMCOLS_PER_PAGE = environment.browseCommunities.communityListPageSize;
8485

8586
/**
8687
* Service class for the community list, responsible for the creating of the flat list used by communityList dataSource

src/app/home-page/top-level-community-list/top-level-community-list.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { PaginationComponentOptions } from '../../shared/pagination/pagination-c
1212
import { hasValue } from '../../shared/empty.util';
1313
import { switchMap } from 'rxjs/operators';
1414
import { PaginationService } from '../../core/pagination/pagination.service';
15+
import { environment } from 'src/environments/environment';
1516

1617
/**
1718
* this component renders the Top-Level Community list
@@ -54,7 +55,7 @@ export class TopLevelCommunityListComponent implements OnInit, OnDestroy {
5455
private paginationService: PaginationService) {
5556
this.config = new PaginationComponentOptions();
5657
this.config.id = this.pageId;
57-
this.config.pageSize = 5;
58+
this.config.pageSize = environment.browseCommunities.topLevelPageSize;
5859
this.config.currentPage = 1;
5960
this.sortConfig = new SortOptions('dc.title', SortDirection.ASC);
6061
}

src/config/app-config.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ interface AppConfig extends Config {
3131
defaultLanguage: string;
3232
languages: LangConfig[];
3333
browseBy: BrowseByConfig;
34+
browseCommunities: BrowseCommunitiesConfig;
3435
item: ItemConfig;
3536
collection: CollectionPageConfig;
3637
themes: ThemeConfig[];
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Config } from './config.interface';
2+
3+
export interface BrowseCommunitiesConfig extends Config {
4+
/**
5+
* Number of entries in the expandable community list (per show more).
6+
*/
7+
communityListPageSize: number;
8+
/**
9+
* Number of entries in the paginated (home page) top level community list.
10+
*/
11+
topLevelPageSize: number;
12+
}

src/config/default-app-config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,11 @@ export class DefaultAppConfig implements AppConfig {
210210
defaultLowerLimit: 1900
211211
};
212212

213+
browseCommunities: BrowseCommunitiesConfig = {
214+
communityListPageSize: 20,
215+
topLevelPageSize: 5
216+
}
217+
213218
// Item Config
214219
item: ItemConfig = {
215220
edit: {

src/environments/environment.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ export const environment: BuildConfig = {
204204
// The absolute lowest year to display in the dropdown (only used when no lowest date can be found for all items)
205205
defaultLowerLimit: 1900,
206206
},
207+
browseCommunities: {
208+
communityListPageSize: 20,
209+
topLevelPageSize: 5
210+
},
207211
item: {
208212
edit: {
209213
undoTimeout: 10000 // 10 seconds

0 commit comments

Comments
 (0)