Comcol Handle component

This commit is contained in:
L. Henze
2019-09-23 12:43:00 -04:00
parent 948fa5cfee
commit 2aaa0cf726
2 changed files with 5 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
<div *ngIf="content" class="content-with-optional-title mb-2">
<h2 class="d-inline-block h6" *ngIf="title">{{ title | translate }}</h2>
<div class="d-inline-block "><a href="{{content}}">{{content}}</a></div>
<div class="d-inline-block "><a href="{{getHandle(content)}}">{{getHandle(content)}}</a></div>
</div>

View File

@@ -1,13 +1,10 @@
import { Observable, of as observableOf, combineLatest as observableCombineLatest } from 'rxjs';
import { Component, Input } from '@angular/core';
import { Component, Input, Inject, Injectable } from '@angular/core';
import { GlobalConfig } from '../../../config/global-config.interface';
import { Inject, Injectable } from '@angular/core';
import { GLOBAL_CONFIG } from '../../../config';
import { RESTURLCombiner } from '../../core/url-combiner/rest-url-combiner';
import { URLCombiner } from '../../core/url-combiner/url-combiner';
/**
* This component renders the value of "handle"
* This component builds a URL from the value of "handle"
*/
@Component({
@@ -22,7 +19,7 @@ export class ComcolPageHandleComponent {
// Optional title
@Input() title: string;
// The content to render.
// The value of "handle"
@Input() content: string;
constructor(@Inject(GLOBAL_CONFIG) private EnvConfig: GlobalConfig) {
@@ -31,8 +28,7 @@ export class ComcolPageHandleComponent {
return new RESTURLCombiner(this.EnvConfig, '/').toString();
}
public getHandle(content: string): string {
const href = new URLCombiner(this.getRootHref(), '/handle/', this.content).toString();
return href;
return new URLCombiner(this.getRootHref(), '/handle/', this.content).toString();
}
}