mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
33 lines
947 B
TypeScript
33 lines
947 B
TypeScript
import { Component, Input } from '@angular/core';
|
|
import { MetadataRepresentation } from '../../../core/shared/metadata-representation/metadata-representation.model';
|
|
import { Context } from '../../../core/shared/context.model';
|
|
|
|
@Component({
|
|
selector: 'ds-metadata-representation-list-element',
|
|
template: ''
|
|
})
|
|
/**
|
|
* An abstract class for displaying a single MetadataRepresentation
|
|
*/
|
|
export class MetadataRepresentationListElementComponent {
|
|
/**
|
|
* The optional context
|
|
*/
|
|
@Input() context: Context;
|
|
|
|
/**
|
|
* The metadata representation of this component
|
|
*/
|
|
@Input() mdRepresentation: MetadataRepresentation;
|
|
|
|
/**
|
|
* Returns true if this component's value matches a basic regex "Is this an HTTP URL" test
|
|
*/
|
|
isLink(): boolean {
|
|
// Match any string that begins with http:// or https://
|
|
const linkPattern = new RegExp(/^https?:\/\/.*/);
|
|
return linkPattern.test(this.mdRepresentation.getValue());
|
|
}
|
|
|
|
}
|