mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +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
|
||||
*/
|
||||
get handle(): string {
|
||||
const metadataValue = this.firstMetadataValue('dc.identifier.uri');
|
||||
return metadataValue ? metadataValue : this._handle;
|
||||
return this.firstMetadataValue('dc.identifier.uri');
|
||||
}
|
||||
|
||||
set handle(value: string) {
|
||||
this._handle = value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The introductory text of this Collection
|
||||
* 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
|
||||
*/
|
||||
get handle(): string {
|
||||
const metadataValue = this.firstMetadataValue('dc.identifier.uri');
|
||||
return metadataValue ? metadataValue : this._handle;
|
||||
return this.firstMetadataValue('dc.identifier.uri');
|
||||
}
|
||||
|
||||
set handle(value: string) {
|
||||
|
@@ -39,7 +39,7 @@ describe('ComcolPageHandleComponent', () => {
|
||||
});
|
||||
|
||||
describe('should create a link pointing the handle', () => {
|
||||
|
||||
|
||||
it('should use the content if it includes the http protocol', () => {
|
||||
component.content = handleWithProtocol;
|
||||
fixture.detectChanges();
|
||||
@@ -48,15 +48,6 @@ describe('ComcolPageHandleComponent', () => {
|
||||
expect(link.nativeElement.getAttribute('href')).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;
|
||||
|
||||
public getHandle(): string {
|
||||
return this.content.includes('http') ? this.content
|
||||
: new UIURLCombiner('/handle/', this.content).toString();
|
||||
}}
|
||||
|
||||
return this.content;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user