Skip to content

Commit 9e5af3f

Browse files
milanmajchrakclaude
andcommitted
Show related person and org unit names as text
The name comes from virtual metadata of the related entity. It has no hit highlights, so it does not need HTML. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 6e84e9d commit 9e5af3f

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

‎src/app/entity-groups/research-entities/metadata-representations/org-unit/org-unit-item-metadata-list-element.component.html‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@
77
</ng-template>
88
<ds-truncatable [id]="mdRepresentation.id">
99
<a [routerLink]="[itemPageRoute]"
10-
[innerHTML]="mdRepresentation.getValue()"
11-
[ngbTooltip]="mdRepresentation.hasMetadata(['dc.description']) ? descTemplate : null"></a>
10+
[ngbTooltip]="mdRepresentation.hasMetadata(['dc.description']) ? descTemplate : null">{{mdRepresentation.getValue()}}</a>
1211
</ds-truncatable>

‎src/app/entity-groups/research-entities/metadata-representations/person/person-item-metadata-list-element.component.html‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
</ng-template>
1111
<ds-truncatable [id]="mdRepresentation.id">
1212
<a [routerLink]="[itemPageRoute]"
13-
[innerHTML]="mdRepresentation.getValue()"
14-
[ngbTooltip]="mdRepresentation.allMetadata(['person.jobTitle']).length > 0 ? descTemplate : null"></a>
13+
[ngbTooltip]="mdRepresentation.allMetadata(['person.jobTitle']).length > 0 ? descTemplate : null">{{mdRepresentation.getValue()}}</a>
1514
<ds-orcid-badge-and-tooltip class="ml-1"
1615
*ngIf="mdRepresentation.firstMetadata('person.identifier.orcid')"
1716
[orcid]="mdRepresentation.firstMetadata('person.identifier.orcid')"

‎src/app/entity-groups/research-entities/metadata-representations/person/person-item-metadata-list-element.component.spec.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ describe('PersonItemMetadataListElementComponent', () => {
4545
expect(linkText).toBe(lastName + ', ' + firstName);
4646
});
4747

48+
it('should show markup in the name as text', () => {
49+
const name = 'Anonymous <img src="https://example.org/pixel.png">';
50+
comp.mdRepresentation = Object.assign(new ItemMetadataRepresentation(Object.assign(new MetadataValue(), { value: name })), mockItem);
51+
fixture.detectChanges();
52+
const link = fixture.debugElement.query(By.css('a'));
53+
expect(link.query(By.css('img'))).toBeNull();
54+
expect(link.nativeElement.textContent).toBe(name);
55+
});
56+
4857
it('should show the description on hover over the link in a tooltip', () => {
4958
const link = fixture.debugElement.query(By.css('a'));
5059
link.triggerEventHandler('mouseenter', null);

0 commit comments

Comments
 (0)