diff --git a/src/app/home-page/top-level-community-list/top-level-community-list.component.html b/src/app/home-page/top-level-community-list/top-level-community-list.component.html index 00446d658a..8b0ee4b853 100644 --- a/src/app/home-page/top-level-community-list/top-level-community-list.component.html +++ b/src/app/home-page/top-level-community-list/top-level-community-list.component.html @@ -8,6 +8,7 @@ diff --git a/src/app/home-page/top-level-community-list/top-level-community-list.component.ts b/src/app/home-page/top-level-community-list/top-level-community-list.component.ts index 4af7bcc483..7f3e384df8 100644 --- a/src/app/home-page/top-level-community-list/top-level-community-list.component.ts +++ b/src/app/home-page/top-level-community-list/top-level-community-list.component.ts @@ -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. @@ -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() { diff --git a/src/app/shared/object-collection/object-collection.component.ts b/src/app/shared/object-collection/object-collection.component.ts index c7849adbff..d44c0153b2 100644 --- a/src/app/shared/object-collection/object-collection.component.ts +++ b/src/app/shared/object-collection/object-collection.component.ts @@ -85,7 +85,7 @@ export class ObjectCollectionComponent implements OnInit { /** * Whether to show an RSS syndication button for the current search options */ - @Input() showRSS = false; + @Input() showRSS: SortOptions | boolean = false; /** * Emit custom event for listable object custom actions. diff --git a/src/app/shared/object-detail/object-detail.component.ts b/src/app/shared/object-detail/object-detail.component.ts index eae56a217d..67037aa6bd 100644 --- a/src/app/shared/object-detail/object-detail.component.ts +++ b/src/app/shared/object-detail/object-detail.component.ts @@ -85,7 +85,10 @@ export class ObjectDetailComponent { */ @Input() showThumbnails; - @Input() showRSS = false; + /** + * 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. diff --git a/src/app/shared/object-list/object-list.component.ts b/src/app/shared/object-list/object-list.component.ts index 19d3cc9906..3c0136fec9 100644 --- a/src/app/shared/object-list/object-list.component.ts +++ b/src/app/shared/object-list/object-list.component.ts @@ -73,7 +73,7 @@ export class ObjectListComponent { /** * Whether to show an RSS syndication button for the current search options */ - @Input() showRSS = false; + @Input() showRSS: SortOptions | boolean = false; /** * The link type of the listable elements diff --git a/src/app/shared/object-list/themed-object-list.component.ts b/src/app/shared/object-list/themed-object-list.component.ts index 65309678bf..df932e3a0f 100644 --- a/src/app/shared/object-list/themed-object-list.component.ts +++ b/src/app/shared/object-list/themed-object-list.component.ts @@ -59,7 +59,7 @@ export class ThemedObjectListComponent extends ThemedComponent } @if (showRSS) { - + } diff --git a/src/app/shared/pagination/pagination.component.ts b/src/app/shared/pagination/pagination.component.ts index 7392d8f91e..a10373af1e 100644 --- a/src/app/shared/pagination/pagination.component.ts +++ b/src/app/shared/pagination/pagination.component.ts @@ -173,7 +173,7 @@ export class PaginationComponent implements OnChanges, OnDestroy, OnInit { * 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 = false; + @Input() public showRSS: SortOptions | boolean = false; /** * Current page. @@ -442,4 +442,19 @@ export class PaginationComponent implements OnChanges, OnDestroy, OnInit { }); } + /** + * 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; + } + }