[Library | explore-redesign]: linkingGeneric.component: For direct linking, updated back button - trigger browser's back, not landing, since we can reach this page via search results too.

This commit is contained in:
Konstantina Galouni 2023-05-11 22:46:28 +03:00
parent aef1a25a82
commit 10178c5adb
2 changed files with 12 additions and 5 deletions

View File

@ -28,11 +28,10 @@
<div class="uk-container uk-container-large uk-section uk-section-small uk-padding-remove-bottom">
<div class="uk-padding-small uk-padding-remove-horizontal">
<breadcrumbs *ngIf="!inlineEntity" [breadcrumbs]="breadcrumbs"></breadcrumbs>
<!-- [routerLink]="properties.searchLinkToResult.split('?')[0]"-->
<!-- [queryParams]="routerHelper.createQueryParam('id', inlineEntity.id)"-->
<!-- [routerLink]="inlineEntity.result?.url.split('?')[0]"-->
<!-- [queryParams]="routerHelper.createQueryParam(inlineEntity.result?.url.split('?')[1].split('=')[0], inlineEntity.id)"-->
<a *ngIf="inlineEntity && inlineEntity.result"
[routerLink]="inlineEntity.result?.url.split('?')[0]"
[queryParams]="routerHelper.createQueryParam(inlineEntity.result?.url.split('?')[1].split('=')[0], inlineEntity.id)"
(click)="back()"
class="uk-button uk-button-link uk-text-transform-none uk-flex uk-flex-middle">
<icon name="west" [flex]="true"></icon>
<span class="uk-margin-small-left">Back to {{getEntityName(inlineEntity.type, false)}}</span>

View File

@ -15,6 +15,7 @@ import {Breadcrumb} from "../../utils/breadcrumbs/breadcrumbs.component";
import {OpenaireEntities} from "../../utils/properties/searchFields";
import {StringUtils} from "../../utils/string-utils.class";
import {RouterHelper} from "../../utils/routerHelper.class";
import { Location } from '@angular/common';
@Component({
selector: 'linking-generic',
@ -50,7 +51,8 @@ export class LinkingGenericComponent {
constructor (private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService,
private _meta: Meta, private _title: Title, private _piwikService:PiwikService,
private seoService: SEOService, private helper: HelperService, private cdr: ChangeDetectorRef ) {
private seoService: SEOService, private helper: HelperService, private cdr: ChangeDetectorRef,
private location: Location) {
}
subscriptions = [];
@ -201,4 +203,10 @@ export class LinkingGenericComponent {
private getEntityName (entityType:string, plural:boolean) {
return StringUtils.getEntityName(entityType, plural);
}
back(): void {
if(typeof document !== 'undefined') {
this.location.back();
}
}
}