[Library | develop]: [Bug fix] landing-utils/fos.component.ts & fos/fos.component.ts & fos/fos.component.html: Added methods "buildFosQueryParam()" and "buildFosHrefParam()" to build and set in fos links, search param "fos" for production and "foslabel" for beta or dev environments.
This commit is contained in:
parent
13d0430109
commit
2e33c470e9
|
@ -95,7 +95,7 @@
|
|||
<div [id]="item.id" *ngFor="let item of fos; index as i">
|
||||
<div class="uk-text-capitalize">
|
||||
<h2 class="uk-h4 uk-margin-remove">
|
||||
<a [routerLink]="properties.searchLinkToResults" [queryParams]="{'fos': urlEncodeAndQuote(item.id)}"
|
||||
<a [routerLink]="properties.searchLinkToResults" [queryParams]="buildFosQueryParam(item)"
|
||||
class="uk-link-text">
|
||||
{{item.id}}
|
||||
</a>
|
||||
|
@ -105,13 +105,13 @@
|
|||
<div *ngFor="let child of item.children">
|
||||
<div class="uk-text-capitalize">
|
||||
<h3 class="uk-h6 uk-margin-small-bottom">
|
||||
<a [routerLink]="properties.searchLinkToResults" [queryParams]="{'fos': urlEncodeAndQuote(child.id)}"
|
||||
<a [routerLink]="properties.searchLinkToResults" [queryParams]="buildFosQueryParam(child)"
|
||||
class="uk-link-text">
|
||||
{{child.id}}
|
||||
</a>
|
||||
</h3>
|
||||
<div *ngFor="let subChild of child.children" style="margin-bottom: 5px;">
|
||||
<a [routerLink]="properties.searchLinkToResults" [queryParams]="{'fos': urlEncodeAndQuote(subChild.id)}"
|
||||
<a [routerLink]="properties.searchLinkToResults" [queryParams]="buildFosQueryParam(subChild)"
|
||||
class="uk-link-text">
|
||||
{{subChild.label}}
|
||||
</a>
|
||||
|
@ -126,19 +126,19 @@
|
|||
<div
|
||||
class="uk-margin-large-bottom uk-padding uk-padding-remove-top uk-padding-remove-horizontal uk-text-capitalize" [class.custom-bottom-border]="i < viewResults.length - 1">
|
||||
<h2 class="uk-h4 uk-margin-remove">
|
||||
<a [routerLink]="properties.searchLinkToResults" [queryParams]="{'fos': urlEncodeAndQuote(item.id)}"
|
||||
<a [routerLink]="properties.searchLinkToResults" [queryParams]="buildFosQueryParam(item)"
|
||||
class="uk-link-text" [innerHTML]="highlightKeyword(item.id)">
|
||||
</a>
|
||||
</h2>
|
||||
<div class="uk-grid uk-child-width-1-3 uk-margin-large-top uk-margin-medium-bottom" uk-grid="masonry: false">
|
||||
<div *ngFor="let subItem of item.children">
|
||||
<h3 class="uk-h6 uk-margin-small-bottom">
|
||||
<a [routerLink]="properties.searchLinkToResults" [queryParams]="{'fos': urlEncodeAndQuote(subItem.id)}"
|
||||
<a [routerLink]="properties.searchLinkToResults" [queryParams]="buildFosQueryParam(subItem)"
|
||||
class="uk-link-text" [innerHTML]="highlightKeyword(subItem.id)">
|
||||
</a>
|
||||
</h3>
|
||||
<div *ngFor="let subSubItem of subItem.children" style="margin-bottom: 5px;">
|
||||
<a [routerLink]="properties.searchLinkToResults" [queryParams]="{'fos': urlEncodeAndQuote(subSubItem.id)}"
|
||||
<a [routerLink]="properties.searchLinkToResults" [queryParams]="buildFosQueryParam(subSubItem)"
|
||||
class="uk-link-text" [innerHTML]="highlightKeyword(subSubItem.label)">
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -214,4 +214,8 @@ export class FosComponent implements OnInit, OnDestroy {
|
|||
this._meta.updateTag({content: description}, "name='description'");
|
||||
this._meta.updateTag({content: description}, "property='og:description'");
|
||||
}
|
||||
|
||||
public buildFosQueryParam(fos) {
|
||||
return (properties.environment !== 'production' ? ({'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}) : ({'fos': this.urlEncodeAndQuote(fos.id)}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import {StringUtils} from "../../utils/string-utils.class";
|
|||
<div class="uk-margin-small-top">
|
||||
<div *ngFor="let subject of subjects.slice(0, viewAll?subjects.length:threshold); let i=index" class="uk-text-truncate">
|
||||
<a [routerLink]="properties.searchLinkToResults"
|
||||
[queryParams]="{'fos': urlEncodeAndQuote(subject.id)}">
|
||||
[queryParams]="buildFosQueryParam(subject)">
|
||||
{{subject.label}}
|
||||
</a>
|
||||
</div>
|
||||
|
@ -47,11 +47,11 @@ import {StringUtils} from "../../utils/string-utils.class";
|
|||
<div class="uk-width-expand">
|
||||
<div *ngFor="let subject of subjects.slice(0, viewAll?subjects.length:threshold); let i=index" class="uk-text-truncate">
|
||||
<a *ngIf="properties.adminToolsPortalType != 'eosc'"
|
||||
[routerLink]="properties.searchLinkToResults" [queryParams]="{'fos': urlEncodeAndQuote(subject.id)}">
|
||||
[routerLink]="properties.searchLinkToResults" [queryParams]="buildFosQueryParam(subject)">
|
||||
{{subject.label}}
|
||||
</a>
|
||||
<a *ngIf="properties.adminToolsPortalType == 'eosc'" class="custom-external" target="_blank"
|
||||
[href]="'https://explore.openaire.eu'+properties.searchLinkToResults+'?fos='+urlEncodeAndQuote(subject.id)">
|
||||
[href]="'https://explore.openaire.eu'+properties.searchLinkToResults+'?'+buildFosHrefParam(subject)">
|
||||
{{subject.label}}
|
||||
</a>
|
||||
</div>
|
||||
|
@ -60,11 +60,11 @@ import {StringUtils} from "../../utils/string-utils.class";
|
|||
<div *ngIf="viewAll">
|
||||
<div *ngFor="let subject of subjects; let i=index" class="uk-text-truncate">
|
||||
<a *ngIf="properties.adminToolsPortalType != 'eosc'"
|
||||
[routerLink]="properties.searchLinkToResults" [queryParams]="{'fos': urlEncodeAndQuote(subject.id)}">
|
||||
[routerLink]="properties.searchLinkToResults" [queryParams]="buildFosQueryParam(subject)">
|
||||
{{subject.label}}
|
||||
</a>
|
||||
<a *ngIf="properties.adminToolsPortalType == 'eosc'" class="custom-external" target="_blank"
|
||||
[href]="'https://explore.openaire.eu'+properties.searchLinkToResults+'?fos='+urlEncodeAndQuote(subject.id)">
|
||||
[href]="'https://explore.openaire.eu'+properties.searchLinkToResults+'?'+buildFosHrefParam(subject)">
|
||||
{{subject.label}}
|
||||
</a>
|
||||
</div>
|
||||
|
@ -115,4 +115,12 @@ export class FosComponent {
|
|||
public urlEncodeAndQuote(str: string): string {
|
||||
return StringUtils.quote(StringUtils.URIEncode(str));
|
||||
}
|
||||
|
||||
public buildFosQueryParam(fos) {
|
||||
return (properties.environment !== 'production' ? ({'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}) : ({'fos': this.urlEncodeAndQuote(fos.id)}));
|
||||
}
|
||||
|
||||
public buildFosHrefParam(fos): string {
|
||||
return (properties.environment !== 'production' ? ('foslabel='+this.urlEncodeAndQuote(fos.id+"||"+fos.label)) : ('fos='+this.urlEncodeAndQuote(fos.id)));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue