mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 21:13:07 +00:00
[CSTPER-222] handle metadata reading for communities and collections
This commit is contained in:
@@ -78,8 +78,7 @@ 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) {
|
||||||
|
@@ -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) {
|
||||||
|
@@ -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