Skip to content

Commit 001d6dc

Browse files
authored
Merge pull request DSpace#1748 from mspalti/new-themes
New theme-able components
2 parents edd193a + 5a815da commit 001d6dc

13 files changed

Lines changed: 127 additions & 8 deletions

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@
2525
</div>
2626
</div>
2727
<section class="comcol-page-browse-section">
28+
2829
<!-- Browse-By Links -->
2930
<ds-themed-comcol-page-browse-by [id]="communityPayload.id" [contentType]="communityPayload.type">
3031
</ds-themed-comcol-page-browse-by>
3132

32-
<ds-community-page-sub-community-list [community]="communityPayload"></ds-community-page-sub-community-list>
33-
<ds-community-page-sub-collection-list [community]="communityPayload"></ds-community-page-sub-collection-list>
33+
<ds-themed-community-page-sub-community-list [community]="communityPayload"></ds-themed-community-page-sub-community-list>
34+
<ds-themed-community-page-sub-collection-list [community]="communityPayload"></ds-themed-community-page-sub-collection-list>
3435
</section>
3536
<footer *ngIf="communityPayload.copyrightText" class="border-top my-5 pt-4">
3637
<!-- Copyright -->

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,18 @@ import { StatisticsModule } from '../statistics/statistics.module';
1313
import { CommunityFormModule } from './community-form/community-form.module';
1414
import { ThemedCommunityPageComponent } from './themed-community-page.component';
1515
import { ComcolModule } from '../shared/comcol/comcol.module';
16+
import {
17+
ThemedCommunityPageSubCommunityListComponent
18+
} from './sub-community-list/themed-community-page-sub-community-list.component';
19+
import {
20+
ThemedCollectionPageSubCollectionListComponent
21+
} from './sub-collection-list/themed-community-page-sub-collection-list.component';
1622

1723
const DECLARATIONS = [CommunityPageComponent,
1824
ThemedCommunityPageComponent,
25+
ThemedCommunityPageSubCommunityListComponent,
1926
CommunityPageSubCollectionListComponent,
27+
ThemedCollectionPageSubCollectionListComponent,
2028
CommunityPageSubCommunityListComponent,
2129
CreateCommunityPageComponent,
2230
DeleteCommunityPageComponent];

src/app/community-page/sub-collection-list/community-page-sub-collection-list.component.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input, OnInit } from '@angular/core';
1+
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
22

33
import { BehaviorSubject, combineLatest as observableCombineLatest } from 'rxjs';
44

@@ -12,16 +12,23 @@ import { SortDirection, SortOptions } from '../../core/cache/models/sort-options
1212
import { CollectionDataService } from '../../core/data/collection-data.service';
1313
import { PaginationService } from '../../core/pagination/pagination.service';
1414
import { switchMap } from 'rxjs/operators';
15+
import { hasValue } from '../../shared/empty.util';
1516

1617
@Component({
1718
selector: 'ds-community-page-sub-collection-list',
1819
styleUrls: ['./community-page-sub-collection-list.component.scss'],
1920
templateUrl: './community-page-sub-collection-list.component.html',
2021
animations:[fadeIn]
2122
})
22-
export class CommunityPageSubCollectionListComponent implements OnInit {
23+
export class CommunityPageSubCollectionListComponent implements OnInit, OnDestroy {
2324
@Input() community: Community;
2425

26+
/**
27+
* Optional page size. Overrides communityList.pageSize configuration for this component.
28+
* Value can be added in the themed version of the parent component.
29+
*/
30+
@Input() pageSize: number;
31+
2532
/**
2633
* The pagination configuration
2734
*/
@@ -50,7 +57,9 @@ export class CommunityPageSubCollectionListComponent implements OnInit {
5057
ngOnInit(): void {
5158
this.config = new PaginationComponentOptions();
5259
this.config.id = this.pageId;
53-
this.config.pageSize = 5;
60+
if (hasValue(this.pageSize)) {
61+
this.config.pageSize = this.pageSize;
62+
}
5463
this.config.currentPage = 1;
5564
this.sortConfig = new SortOptions('dc.title', SortDirection.ASC);
5665
this.initPage();
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { ThemedComponent } from '../../shared/theme-support/themed.component';
2+
import { CommunityPageSubCollectionListComponent } from './community-page-sub-collection-list.component';
3+
import { Component, Input } from '@angular/core';
4+
import { Community } from '../../core/shared/community.model';
5+
6+
@Component({
7+
selector: 'ds-themed-community-page-sub-collection-list',
8+
styleUrls: [],
9+
templateUrl: '../../shared/theme-support/themed.component.html',
10+
})
11+
export class ThemedCollectionPageSubCollectionListComponent extends ThemedComponent<CommunityPageSubCollectionListComponent> {
12+
@Input() community: Community;
13+
@Input() pageSize: number;
14+
protected inAndOutputNames: (keyof CommunityPageSubCollectionListComponent & keyof this)[] = ['community', 'pageSize'];
15+
16+
protected getComponentName(): string {
17+
return 'CommunityPageSubCollectionListComponent';
18+
}
19+
20+
protected importThemedComponent(themeName: string): Promise<any> {
21+
return import(`../../../themes/${themeName}/app/community-page/sub-collection-list/community-page-sub-collection-list.component`);
22+
}
23+
24+
protected importUnthemedComponent(): Promise<any> {
25+
return import(`./community-page-sub-collection-list.component`);
26+
}
27+
28+
}

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input, OnInit } from '@angular/core';
1+
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
22

33
import { BehaviorSubject, combineLatest as observableCombineLatest } from 'rxjs';
44

@@ -12,6 +12,7 @@ import { CommunityDataService } from '../../core/data/community-data.service';
1212
import { takeUntilCompletedRemoteData } from '../../core/shared/operators';
1313
import { switchMap } from 'rxjs/operators';
1414
import { PaginationService } from '../../core/pagination/pagination.service';
15+
import { hasValue } from '../../shared/empty.util';
1516

1617
@Component({
1718
selector: 'ds-community-page-sub-community-list',
@@ -22,9 +23,15 @@ import { PaginationService } from '../../core/pagination/pagination.service';
2223
/**
2324
* Component to render the sub-communities of a Community
2425
*/
25-
export class CommunityPageSubCommunityListComponent implements OnInit {
26+
export class CommunityPageSubCommunityListComponent implements OnInit, OnDestroy {
2627
@Input() community: Community;
2728

29+
/**
30+
* Optional page size. Overrides communityList.pageSize configuration for this component.
31+
* Value can be added in the themed version of the parent component.
32+
*/
33+
@Input() pageSize: number;
34+
2835
/**
2936
* The pagination configuration
3037
*/
@@ -53,7 +60,9 @@ export class CommunityPageSubCommunityListComponent implements OnInit {
5360
ngOnInit(): void {
5461
this.config = new PaginationComponentOptions();
5562
this.config.id = this.pageId;
56-
this.config.pageSize = 5;
63+
if (hasValue(this.pageSize)) {
64+
this.config.pageSize = this.pageSize;
65+
}
5766
this.config.currentPage = 1;
5867
this.sortConfig = new SortOptions('dc.title', SortDirection.ASC);
5968
this.initPage();
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { ThemedComponent } from '../../shared/theme-support/themed.component';
2+
import { CommunityPageSubCommunityListComponent } from './community-page-sub-community-list.component';
3+
import { Component, Input } from '@angular/core';
4+
import { Community } from '../../core/shared/community.model';
5+
6+
@Component({
7+
selector: 'ds-themed-community-page-sub-community-list',
8+
styleUrls: [],
9+
templateUrl: '../../shared/theme-support/themed.component.html',
10+
})
11+
export class ThemedCommunityPageSubCommunityListComponent extends ThemedComponent<CommunityPageSubCommunityListComponent> {
12+
13+
@Input() community: Community;
14+
@Input() pageSize: number;
15+
protected inAndOutputNames: (keyof CommunityPageSubCommunityListComponent & keyof this)[] = ['community', 'pageSize'];
16+
17+
protected getComponentName(): string {
18+
return 'CommunityPageSubCommunityListComponent';
19+
}
20+
21+
protected importThemedComponent(themeName: string): Promise<any> {
22+
return import(`../../../themes/${themeName}/app/community-page/sub-community-list/community-page-sub-community-list.component`);
23+
}
24+
25+
protected importUnthemedComponent(): Promise<any> {
26+
return import(`./community-page-sub-community-list.component`);
27+
}
28+
29+
}

src/themes/custom/app/community-page/sub-collection-list/community-page-sub-collection-list.component.html

Whitespace-only changes.

src/themes/custom/app/community-page/sub-collection-list/community-page-sub-collection-list.component.scss

Whitespace-only changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Component } from '@angular/core';
2+
import { CommunityPageSubCollectionListComponent as BaseComponent }
3+
from '../../../../../app/community-page/sub-collection-list/community-page-sub-collection-list.component';
4+
5+
@Component({
6+
selector: 'ds-community-page-sub-collection-list',
7+
// styleUrls: ['./community-page-sub-collection-list.component.scss'],
8+
styleUrls: ['../../../../../app/community-page/sub-collection-list/community-page-sub-collection-list.component.scss'],
9+
// templateUrl: './community-page-sub-collection-list.component.html',
10+
templateUrl: '../../../../../app/community-page/sub-collection-list/community-page-sub-collection-list.component.html'
11+
})
12+
export class CommunityPageSubCollectionListComponent extends BaseComponent {}

src/themes/custom/app/community-page/sub-community-list/community-page-sub-community-list.component.html

Whitespace-only changes.

0 commit comments

Comments
 (0)