From 91eb91f7f73e40dfb383859e54795139b188b68c Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 4 Mar 2021 12:45:01 +0000 Subject: [PATCH] [Library | Trunk]: Add url prefix pipe git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60575 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../sharedComponents/sidebar/sideBar.component.html | 2 +- dashboard/sharedComponents/sidebar/sideBar.module.ts | 4 +++- utils/pipes/url-prefix.module.ts | 8 ++++++++ utils/pipes/url-prefix.pipe.ts | 10 ++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 utils/pipes/url-prefix.module.ts create mode 100644 utils/pipes/url-prefix.pipe.ts diff --git a/dashboard/sharedComponents/sidebar/sideBar.component.html b/dashboard/sharedComponents/sidebar/sideBar.component.html index 7a2dc3d4..06694545 100644 --- a/dashboard/sharedComponents/sidebar/sideBar.component.html +++ b/dashboard/sharedComponents/sidebar/sideBar.component.html @@ -6,7 +6,7 @@ [src]="'assets/common-assets/'+(properties.environment =='beta'?'beta_flag.svg':'prototype_flag.svg')" [alt]="properties.environment">
{{headerName}}
diff --git a/dashboard/sharedComponents/sidebar/sideBar.module.ts b/dashboard/sharedComponents/sidebar/sideBar.module.ts index 4f17e096..6958e4b5 100644 --- a/dashboard/sharedComponents/sidebar/sideBar.module.ts +++ b/dashboard/sharedComponents/sidebar/sideBar.module.ts @@ -4,11 +4,13 @@ import {CommonModule} from '@angular/common'; import {RouterModule} from "@angular/router"; import {SideBarComponent} from './sideBar.component'; +import {UrlPrefixModule} from "../../../utils/pipes/url-prefix.module"; @NgModule({ imports: [ CommonModule, - RouterModule + RouterModule, + UrlPrefixModule ], declarations: [ SideBarComponent diff --git a/utils/pipes/url-prefix.module.ts b/utils/pipes/url-prefix.module.ts new file mode 100644 index 00000000..366c8a82 --- /dev/null +++ b/utils/pipes/url-prefix.module.ts @@ -0,0 +1,8 @@ +import {NgModule} from "@angular/core"; +import {UrlPrefixPipe} from "./url-prefix.pipe"; + +@NgModule({ + declarations: [UrlPrefixPipe], + exports: [UrlPrefixPipe] +}) +export class UrlPrefixModule {} diff --git a/utils/pipes/url-prefix.pipe.ts b/utils/pipes/url-prefix.pipe.ts new file mode 100644 index 00000000..1e62492d --- /dev/null +++ b/utils/pipes/url-prefix.pipe.ts @@ -0,0 +1,10 @@ +import {Pipe, PipeTransform} from "@angular/core"; +import {DomSanitizer, SafeUrl} from "@angular/platform-browser"; +import {StringUtils} from "../string-utils.class"; + +@Pipe({name: 'urlPrefix'}) +export class UrlPrefixPipe implements PipeTransform { + transform(value): SafeUrl { + return StringUtils.urlPrefix(value) + value; + } +}