diff --git a/src/app/community-list-page/community-list-adapter.ts b/src/app/community-list-page/community-list-adapter.ts index c9443675a7..b5e5ef4ca5 100644 --- a/src/app/community-list-page/community-list-adapter.ts +++ b/src/app/community-list-page/community-list-adapter.ts @@ -10,6 +10,8 @@ import {Collection} from '../core/shared/collection.model'; import {hasValue, isNotEmpty} from '../shared/empty.util'; import {RemoteData} from '../core/data/remote-data'; import {PaginatedList} from '../core/data/paginated-list'; +import {getCommunityPageRoute} from "../+community-page/community-page-routing.module"; +import {getCollectionPageRoute} from "../+collection-page/collection-page-routing.module"; export interface FlatNode { isExpandable: boolean; @@ -20,6 +22,7 @@ export interface FlatNode { parent?: FlatNode; payload: Community | Collection; isShowMoreNode: boolean; + route?: string; } export const combineAndFlatten = (obsList: Array>): Observable => @@ -42,6 +45,7 @@ export const toFlatNode = ( parent, payload: c, isShowMoreNode: false, + route: c instanceof Community ? getCommunityPageRoute(c.id) : getCollectionPageRoute(c.id), }); export const showMoreFlatNode = ( @@ -70,7 +74,7 @@ export class CommunityListAdapter { constructor(private cds: CommunityDataService) { this.config = new PaginationComponentOptions(); this.config.id = 'top-level-pagination'; - this.config.pageSize = 5; + this.config.pageSize = 10; this.config.currentPage = 1; this.sortConfig = new SortOptions('dc.title', SortDirection.ASC); this.initTopCommunityList() diff --git a/src/app/community-list-page/community-list/community-list.component.html b/src/app/community-list-page/community-list/community-list.component.html index 1aaf07bbcb..abb3e61c59 100644 --- a/src/app/community-list-page/community-list/community-list.component.html +++ b/src/app/community-list-page/community-list/community-list.component.html @@ -18,17 +18,23 @@ - - -
- - {{node.name}} - -
-
- {{node.payload.shortDescription}} + class="example-tree-node"> +
+ +
+ + {{node.name}} + +
+
+
+
+ + {{node.payload.shortDescription}} +
@@ -38,18 +44,22 @@
- + {{node.name}}
-
- {{node.payload.shortDescription}} +
+
+ + {{node.payload.shortDescription}} +
diff --git a/src/app/community-list-page/community-list/community-list.component.ts b/src/app/community-list-page/community-list/community-list.component.ts index 6d0ad09ab0..0a9d369cdf 100644 --- a/src/app/community-list-page/community-list/community-list.component.ts +++ b/src/app/community-list-page/community-list/community-list.component.ts @@ -2,8 +2,6 @@ import {Component, OnInit} from '@angular/core'; import {CommunityListAdapter, FlatNode} from '../community-list-adapter'; import {CommunityListDatasource} from '../community-list-datasource'; import {FlatTreeControl} from '@angular/cdk/tree'; -import {getCollectionPageRoute} from '../../+collection-page/collection-page-routing.module'; -import {getCommunityPageRoute} from '../../+community-page/community-page-routing.module'; @Component({ selector: 'ds-community-list', @@ -13,6 +11,7 @@ import {getCommunityPageRoute} from '../../+community-page/community-page-routin export class CommunityListComponent implements OnInit { private expandedNodes: FlatNode[] = []; + private Arr = Array; treeControl = new FlatTreeControl( (node) => node.level, (node) => node.isExpandable @@ -36,11 +35,6 @@ export class CommunityListComponent implements OnInit { return node.isShowMoreNode; } - shouldRender(node: FlatNode) { - const parent = node.parent; - return !parent || parent.isExpanded; - } - toggleExpanded(node: FlatNode) { if (node.isExpanded) { this.expandedNodes = this.expandedNodes.filter((node2) => node2.name !== node.name); @@ -52,14 +46,6 @@ export class CommunityListComponent implements OnInit { this.dataSource.loadCommunities(this.expandedNodes); } - getCollectionRoute(node: FlatNode): string { - return getCollectionPageRoute(node.id); - } - - getCommunityRoute(node: FlatNode): string { - return getCommunityPageRoute(node.id); - } - getNextPage(): void { console.log('go to next page'); // TODO