mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
Comcol Handle component
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<div *ngIf="content" class="content-with-optional-title mb-2">
|
<div *ngIf="content" class="content-with-optional-title mb-2">
|
||||||
<h2 class="d-inline-block h6" *ngIf="title">{{ title | translate }}</h2>
|
<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>
|
</div>
|
||||||
|
@@ -1,13 +1,10 @@
|
|||||||
|
import { Component, Input, Inject, Injectable } from '@angular/core';
|
||||||
import { Observable, of as observableOf, combineLatest as observableCombineLatest } from 'rxjs';
|
|
||||||
import { Component, Input } from '@angular/core';
|
|
||||||
import { GlobalConfig } from '../../../config/global-config.interface';
|
import { GlobalConfig } from '../../../config/global-config.interface';
|
||||||
import { Inject, Injectable } from '@angular/core';
|
|
||||||
import { GLOBAL_CONFIG } from '../../../config';
|
import { GLOBAL_CONFIG } from '../../../config';
|
||||||
import { RESTURLCombiner } from '../../core/url-combiner/rest-url-combiner';
|
import { RESTURLCombiner } from '../../core/url-combiner/rest-url-combiner';
|
||||||
import { URLCombiner } from '../../core/url-combiner/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({
|
@Component({
|
||||||
@@ -22,7 +19,7 @@ export class ComcolPageHandleComponent {
|
|||||||
// Optional title
|
// Optional title
|
||||||
@Input() title: string;
|
@Input() title: string;
|
||||||
|
|
||||||
// The content to render.
|
// The value of "handle"
|
||||||
@Input() content: string;
|
@Input() content: string;
|
||||||
|
|
||||||
constructor(@Inject(GLOBAL_CONFIG) private EnvConfig: GlobalConfig) {
|
constructor(@Inject(GLOBAL_CONFIG) private EnvConfig: GlobalConfig) {
|
||||||
@@ -31,8 +28,7 @@ export class ComcolPageHandleComponent {
|
|||||||
return new RESTURLCombiner(this.EnvConfig, '/').toString();
|
return new RESTURLCombiner(this.EnvConfig, '/').toString();
|
||||||
}
|
}
|
||||||
public getHandle(content: string): string {
|
public getHandle(content: string): string {
|
||||||
const href = new URLCombiner(this.getRootHref(), '/handle/', this.content).toString();
|
return new URLCombiner(this.getRootHref(), '/handle/', this.content).toString();
|
||||||
return href;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user