mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 14:03:06 +00:00
[CSTPER-222] handle metadata reading for communities and collections
This commit is contained in:
@@ -78,14 +78,13 @@ export class Collection extends DSpaceObject implements ChildHALResource {
|
|||||||
* A string representing the unique handle of this Collection
|
* A string representing the unique handle of this Collection
|
||||||
*/
|
*/
|
||||||
get handle(): string {
|
get handle(): string {
|
||||||
const metadataValue = this.firstMetadataValue('dc.identifier.uri');
|
return this.firstMetadataValue('dc.identifier.uri');
|
||||||
return metadataValue ? metadataValue : this._handle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set handle(value: string) {
|
set handle(value: string) {
|
||||||
this._handle = value;
|
this._handle = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The introductory text of this Collection
|
* The introductory text of this Collection
|
||||||
* Corresponds to the metadata field dc.description
|
* Corresponds to the metadata field dc.description
|
||||||
|
@@ -67,8 +67,7 @@ export class Community extends DSpaceObject implements ChildHALResource {
|
|||||||
* A string representing the unique handle of this Community
|
* A string representing the unique handle of this Community
|
||||||
*/
|
*/
|
||||||
get handle(): string {
|
get handle(): string {
|
||||||
const metadataValue = this.firstMetadataValue('dc.identifier.uri');
|
return this.firstMetadataValue('dc.identifier.uri');
|
||||||
return metadataValue ? metadataValue : this._handle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set handle(value: string) {
|
set handle(value: string) {
|
||||||
|
@@ -39,7 +39,7 @@ describe('ComcolPageHandleComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('should create a link pointing the handle', () => {
|
describe('should create a link pointing the handle', () => {
|
||||||
|
|
||||||
it('should use the content if it includes the http protocol', () => {
|
it('should use the content if it includes the http protocol', () => {
|
||||||
component.content = handleWithProtocol;
|
component.content = handleWithProtocol;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -48,15 +48,6 @@ describe('ComcolPageHandleComponent', () => {
|
|||||||
expect(link.nativeElement.getAttribute('href')).toBe(handleWithProtocol);
|
expect(link.nativeElement.getAttribute('href')).toBe(handleWithProtocol);
|
||||||
expect(link.nativeElement.innerHTML).toBe(handleWithProtocol);
|
expect(link.nativeElement.innerHTML).toBe(handleWithProtocol);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should combine the base uri to the content if it doesnt include the http protocol', () => {
|
|
||||||
component.content = handleWithoutProtocol;
|
|
||||||
fixture.detectChanges();
|
|
||||||
const link = fixture.debugElement.query(By.css('a'));
|
|
||||||
expect(link.nativeElement.getAttribute('href')).toBe(handleWithoutProtocolUIURLCombined);
|
|
||||||
expect(link.nativeElement.innerHTML).toBe(handleWithoutProtocolUIURLCombined);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -21,7 +21,6 @@ export class ComcolPageHandleComponent {
|
|||||||
@Input() content: string;
|
@Input() content: string;
|
||||||
|
|
||||||
public getHandle(): string {
|
public getHandle(): string {
|
||||||
return this.content.includes('http') ? this.content
|
return this.content;
|
||||||
: new UIURLCombiner('/handle/', this.content).toString();
|
}
|
||||||
}}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user