Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/app/app-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,12 @@ export const APP_ROUTES: Route[] = [
path: COMMUNITY_MODULE_PATH,
loadChildren: () => import('./community-page/community-page-routes')
.then((m) => m.ROUTES),
data: { enableRSS: true },
canActivate: [endUserAgreementCurrentUserGuard],
},
{
path: COLLECTION_MODULE_PATH,
loadChildren: () => import('./collection-page/collection-page-routes')
.then((m) => m.ROUTES),
data: { enableRSS: true },
canActivate: [endUserAgreementCurrentUserGuard],
},
{
Expand Down
1 change: 1 addition & 0 deletions src/app/collection-page/collection-page-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export const ROUTES: Route[] = [
data: {
breadcrumbKey: 'collection.search',
menuRoute: MenuRoute.COLLECTION_PAGE,
enableRSS: true,
},
},
{
Expand Down
1 change: 1 addition & 0 deletions src/app/community-page/community-page-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const ROUTES: Route[] = [
data: {
breadcrumbKey: 'community.search',
menuRoute: MenuRoute.COMMUNITY_PAGE,
enableRSS: true,
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ <h2>
<ds-viewable-collection
[config]="config"
[sortConfig]="sortConfig"
[showRSS]="rssSortConfig"
[objects]="communitiesRD$ | async"
[hideGear]="true">
</ds-viewable-collection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ export class TopLevelCommunityListComponent implements OnInit, OnDestroy {
pageId = 'tl';

/**
* The sorting configuration
* The sorting configuration for the community list itself, and the optional RSS feed button
*/
sortConfig: SortOptions;
rssSortConfig: SortOptions;

/**
* The subscription to the observable for the current page.
Expand All @@ -84,6 +85,7 @@ export class TopLevelCommunityListComponent implements OnInit, OnDestroy {
this.config.pageSize = appConfig.homePage.topLevelCommunityList.pageSize;
this.config.currentPage = 1;
this.sortConfig = new SortOptions('dc.title', SortDirection.ASC);
this.rssSortConfig = new SortOptions('dc.date.accessioned', SortDirection.DESC);
}

ngOnInit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
[linkType]="linkType"
[context]="context"
[hidePaginationDetail]="hidePaginationDetail"
[showRSS]="showRSS"
[showPaginator]="showPaginator"
[showThumbnails]="showThumbnails"
(paginationChange)="onPaginationChange($event)"
Expand Down Expand Up @@ -58,6 +59,7 @@
[sortConfig]="sortConfig"
[objects]="objects"
[hideGear]="hideGear"
[showRSS]="showRSS"
[linkType]="linkType"
[context]="context"
[hidePaginationDetail]="hidePaginationDetail"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,22 @@ export class ObjectCollectionComponent implements OnInit {
@Input() sortConfig: SortOptions;

/**
* Whether or not the list elements have a border or not
* Whether the list elements have a border or not
*/
@Input() hasBorder = false;

/**
* Whether or not to hide the gear to change the sort and pagination configuration
* Whether to hide the gear to change the sort and pagination configuration
*/
@Input() hideGear = false;
@Input() selectable = false;
@Input() selectionConfig: {repeatable: boolean, listId: string};

/**
* Whether to show an RSS syndication button for the current search options
*/
@Input() showRSS: SortOptions | boolean = false;

/**
* Emit custom event for listable object custom actions.
*/
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/object-detail/object-detail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[sortOptions]="sortConfig"
[objects]="objects"
[hideGear]="hideGear"
[showRSS]="showRSS"
[hidePaginationDetail]="hidePaginationDetail"
[hidePagerWhenSinglePage]="hidePagerWhenSinglePage"
[showPaginator]="showPaginator"
Expand Down
5 changes: 5 additions & 0 deletions src/app/shared/object-detail/object-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ export class ObjectDetailComponent {
*/
@Input() showThumbnails;

/**
* Whether to show the RSS syndication link. Either false, or valid SortOptions object
*/
@Input() showRSS: SortOptions | boolean = false;

/**
* Emit when one of the listed object has changed.
*/
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/object-list/object-list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[objects]="objects"
[sortOptions]="sortConfig"
[hideGear]="hideGear"
[showRSS]="showRSS"
[hidePagerWhenSinglePage]="hidePagerWhenSinglePage"
[hidePaginationDetail]="hidePaginationDetail"
[showPaginator]="showPaginator"
Expand Down
7 changes: 6 additions & 1 deletion src/app/shared/object-list/object-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { SelectableListService } from './selectable-list/selectable-list.service
})
export class ObjectListComponent {
/**
* The view mode of the this component
* The view mode of this component
*/
viewMode = ViewMode.ListElement;

Expand Down Expand Up @@ -70,6 +70,11 @@ export class ObjectListComponent {
@Input() selectable = false;
@Input() selectionConfig: { repeatable: boolean, listId: string };

/**
* Whether to show an RSS syndication button for the current search options
*/
@Input() showRSS: SortOptions | boolean = false;

/**
* The link type of the listable elements
*/
Expand Down
3 changes: 3 additions & 0 deletions src/app/shared/object-list/themed-object-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export class ThemedObjectListComponent extends ThemedComponent<ObjectListCompone

@Input() selectionConfig: { repeatable: boolean, listId: string };

@Input() showRSS: SortOptions | boolean = false;

/**
* The link type of the listable elements
*/
Expand Down Expand Up @@ -163,6 +165,7 @@ export class ThemedObjectListComponent extends ThemedComponent<ObjectListCompone
'sortConfig',
'hasBorder',
'hideGear',
'showRSS',
'hidePagerWhenSinglePage',
'selectable',
'selectionConfig',
Expand Down
4 changes: 3 additions & 1 deletion src/app/shared/pagination/pagination.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
</ul>
</div>
}
<ds-rss></ds-rss>
@if (showRSS !== false) {
<ds-rss [sortConfig]="rssSortOptions"></ds-rss>
}
</div>
</div>
</div>
Expand Down
23 changes: 22 additions & 1 deletion src/app/shared/pagination/pagination.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@
*/
@Input() public retainScrollPosition = false;

/**
* Options for showing or hiding the RSS syndication feed. This is useful for e.g. top-level community lists
* or other lists where an RSS feed doesn't make sense, but uses the same components as recent items or search result
* lists.
*/
@Input() public showRSS: SortOptions | boolean = false;

/**
* Current page.
*/
Expand Down Expand Up @@ -266,7 +273,6 @@
* Initializes all default variables
*/
private initializeConfig() {
// Set initial values
this.id = this.paginationOptions.id || null;
this.pageSizeOptions = this.paginationOptions.pageSizeOptions;
this.currentPage$ = this.paginationService.getCurrentPagination(this.id, this.paginationOptions).pipe(
Expand Down Expand Up @@ -436,4 +442,19 @@
});
}

/**
* Get the sort options to use for the RSS feed. Defaults to the sort options used for this pagination component
* so it matches the search/browse context, but also allows more flexibility if, for example a top-level community
* list is displayed in "title asc" order, but the RSS feed should default to an item list of "date desc" order.
* If the SortOptions are null, incomplete or invalid, the pagination sortOptions will be used instead.
*/
get rssSortOptions() {
if (this.showRSS !== false && this.showRSS instanceof SortOptions
&& this.showRSS.direction !== null
&& this.showRSS.field !== null) {
return this.showRSS;
}
return this.sortOptions;

Check warning on line 457 in src/app/shared/pagination/pagination.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/shared/pagination/pagination.component.ts#L457

Added line #L457 was not covered by tests
}

}
Loading
Loading