mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
70090: Added trail for processes pages
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { Router } from '@angular/router';
|
||||
import { ActivatedRoute, ActivatedRouteSnapshot, Router } from '@angular/router';
|
||||
import { hasValue } from '../empty.util';
|
||||
import { URLCombiner } from '../../core/url-combiner/url-combiner';
|
||||
|
||||
/**
|
||||
* Util function to retrieve the current path (without query parameters) the user is on
|
||||
@@ -8,3 +10,11 @@ export function currentPath(router: Router) {
|
||||
const urlTree = router.parseUrl(router.url);
|
||||
return '/' + urlTree.root.children.primary.segments.map((it) => it.path).join('/')
|
||||
}
|
||||
|
||||
export function currentPathFromSnapshot(route: ActivatedRouteSnapshot): string {
|
||||
if (hasValue(route.parent)) {
|
||||
const parentRoute: string = currentPathFromSnapshot(route.parent);
|
||||
return new URLCombiner(parentRoute, route.routeConfig.path).toString();
|
||||
}
|
||||
return route.routeConfig ? route.routeConfig.path : '';
|
||||
}
|
||||
|
Reference in New Issue
Block a user