Skip to content

Commit 02e91dd

Browse files
authored
Merge pull request DSpace#3005 from tdonohue/fix_subscription_links
Fix broken links on `/subscriptions` page
2 parents d8a2468 + b86c707 commit 02e91dd

2 files changed

Lines changed: 5 additions & 19 deletions

File tree

src/app/shared/subscriptions/subscription-view/subscription-view.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<td class="dso-info">
22
<ng-container *ngIf="!!dso">
33
<ds-type-badge [object]="dso"></ds-type-badge>
4-
<p><a [routerLink]="[getPageRoutePrefix(), dso.id]">{{ dsoNameService.getName(dso) }}</a></p>
4+
<p><a [routerLink]="getPageRoute(dso)">{{ dsoNameService.getName(dso) }}</a></p>
55
</ng-container>
66
<ng-container *ngIf="!dso">
77
<p class="my-0">{{ 'subscriptions.table.not-available' | translate }}</p>

src/app/shared/subscriptions/subscription-view/subscription-view.component.ts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ import {
1515
} from '@ng-bootstrap/ng-bootstrap';
1616
import { TranslateModule } from '@ngx-translate/core';
1717
import { take } from 'rxjs/operators';
18+
import { getDSORoute } from 'src/app/app-routing-paths';
1819

19-
import { getCollectionModuleRoute } from '../../../collection-page/collection-page-routing-paths';
20-
import { getCommunityModuleRoute } from '../../../community-page/community-page-routing-paths';
2120
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
2221
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
23-
import { getItemModuleRoute } from '../../../item-page/item-page-routing-paths';
2422
import { ConfirmationModalComponent } from '../../confirmation-modal/confirmation-modal.component';
2523
import { hasValue } from '../../empty.util';
2624
import { ThemedTypeBadgeComponent } from '../../object-collection/shared/badges/type-badge/themed-type-badge.component';
@@ -73,22 +71,10 @@ export class SubscriptionViewComponent {
7371
) { }
7472

7573
/**
76-
* Return the prefix of the route to the dso object page ( e.g. "items")
74+
* Return the route to the dso object page
7775
*/
78-
getPageRoutePrefix(): string {
79-
let routePrefix;
80-
switch (this.dso.type.value) {
81-
case 'community':
82-
routePrefix = getCommunityModuleRoute();
83-
break;
84-
case 'collection':
85-
routePrefix = getCollectionModuleRoute();
86-
break;
87-
case 'item':
88-
routePrefix = getItemModuleRoute();
89-
break;
90-
}
91-
return routePrefix;
76+
getPageRoute(dso: DSpaceObject): string {
77+
return getDSORoute(dso);
9278
}
9379

9480
/**

0 commit comments

Comments
 (0)