[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
This commit is contained in:
k.triantafyllou 2021-03-04 12:45:01 +00:00
parent 7f9b8513cd
commit 91eb91f7f7
4 changed files with 22 additions and 2 deletions

View File

@ -6,7 +6,7 @@
[src]="'assets/common-assets/'+(properties.environment =='beta'?'beta_flag.svg':'prototype_flag.svg')"
[alt]="properties.environment">
<div class="logo" [class.portal-logo]="!headerLogoUrl">
<img *ngIf="headerLogoUrl" [src]="headerLogoUrl">
<img *ngIf="headerLogoUrl" [src]="headerLogoUrl | urlPrefix">
<div *ngIf="logoLabel" class="logo-label uk-position-bottom-right">{{logoLabel}}</div>
</div>
<div *ngIf="headerName" class="uk-disabled uk-text-muted uk-margin-small-left uk-margin-small-right" [class.uk-text-center]="!open" [ngClass]="open?('uk-text-' + headerPosition):''">{{headerName}}</div>

View File

@ -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

View File

@ -0,0 +1,8 @@
import {NgModule} from "@angular/core";
import {UrlPrefixPipe} from "./url-prefix.pipe";
@NgModule({
declarations: [UrlPrefixPipe],
exports: [UrlPrefixPipe]
})
export class UrlPrefixModule {}

View File

@ -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;
}
}