Skip to content

Commit a4b9a6d

Browse files
94481: Use DSONameService in all other remaining place where dc.title, person.familyName, person.givenName or organization.legalName is used
1 parent 80a1eed commit a4b9a6d

20 files changed

Lines changed: 58 additions & 63 deletions

File tree

src/app/core/breadcrumbs/dso-name.service.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,14 @@ export class DSONameService {
5757
.filter((type) => typeof type === 'string')
5858
.find((type: string) => Object.keys(this.factories).includes(type)) as string;
5959

60+
let name;
6061
if (hasValue(match)) {
61-
return this.factories[match](dso);
62-
} else {
63-
return this.factories.Default(dso);
62+
name = this.factories[match](dso);
6463
}
64+
if (isEmpty(name)) {
65+
name = this.factories.Default(dso);
66+
}
67+
return name;
6568
}
6669

6770
}

src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-issue/journal-issue-search-result-grid-element.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<div class="card-body">
2222
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
2323
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
24-
<h4 class="card-title" [innerHTML]="firstMetadataValue('dc.title')"></h4>
24+
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
2525
</ds-truncatable-part>
2626
<p *ngIf="dso.hasMetadata('creativework.datePublished')"
2727
class="item-date card-text text-muted">

src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-volume/journal-volume-search-result-grid-element.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<div class="card-body">
2222
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
2323
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
24-
<h4 class="card-title" [innerHTML]="dso.firstMetadataValue('dc.title')"></h4>
24+
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
2525
</ds-truncatable-part>
2626
<p *ngIf="dso.hasMetadata('creativework.datePublished')"
2727
class="item-date card-text text-muted">

src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal/journal-search-result-grid-element.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<div class="card-body">
2222
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
2323
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
24-
<h4 class="card-title" [innerHTML]="firstMetadataValue('dc.title')"></h4>
24+
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
2525
</ds-truncatable-part>
2626
<p *ngIf="dso.hasMetadata('creativework.editor')"
2727
class="item-publisher card-text text-muted">

src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/org-unit/org-unit-search-result-grid-element.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<div class="card-body">
2222
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
2323
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
24-
<h4 class="card-title" [innerHTML]="firstMetadataValue('organization.legalName')"></h4>
24+
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
2525
</ds-truncatable-part>
2626
<p *ngIf="dso.hasMetadata('organization.foundingDate')"
2727
class="item-date card-text text-muted">

src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/person/person-search-result-grid-element.component.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
<div class="card-body">
2222
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
2323
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
24-
<h4 class="card-title"
25-
[innerHTML]="firstMetadataValue('person.familyName') + ', ' + firstMetadataValue('person.givenName')"></h4>
24+
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
2625
</ds-truncatable-part>
2726
<p *ngIf="dso.hasMetadata('person.email')" class="item-email card-text text-muted">
2827
<ds-truncatable-part [id]="dso.id" [minLines]="1">

src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/project/project-search-result-grid-element.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<div class="card-body">
2222
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
2323
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
24-
<h4 class="card-title" [innerHTML]="firstMetadataValue('dc.title')"></h4>
24+
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
2525
</ds-truncatable-part>
2626
<p *ngIf="dso.hasMetadata('dc.description')" class="item-description card-text text-muted">
2727
<ds-truncatable-part [id]="dso.id" [minLines]="3">

src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/org-unit/org-unit-search-result-list-element.component.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
<ds-truncatable [id]="dso.id">
33
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer"
44
[routerLink]="[itemPageRoute]" class="lead"
5-
[innerHTML]="firstMetadataValue('organization.legalName')"></a>
6-
<span *ngIf="linkType == linkTypes.None"
7-
class="lead"
8-
[innerHTML]="firstMetadataValue('organization.legalName')"></span>
5+
[innerHTML]="dsoTitle"></a>
6+
<span *ngIf="linkType == linkTypes.None" class="lead" [innerHTML]="dsoTitle"></span>
97
<span class="text-muted">
108
<ds-truncatable-part [id]="dso.id" [minLines]="3">
119
<span *ngIf="dso.allMetadata(['dc.description']).length > 0"

src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/person/person-search-result-list-element.component.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
<ds-truncatable [id]="dso.id">
33
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer"
44
[routerLink]="[itemPageRoute]" class="lead"
5-
[innerHTML]="name"></a>
6-
<span *ngIf="linkType == linkTypes.None"
7-
class="lead"
8-
[innerHTML]="firstMetadataValue('person.familyName') + ', ' + firstMetadataValue('person.givenName')"></span>
5+
[innerHTML]="dsoTitle"></a>
6+
<span *ngIf="linkType == linkTypes.None" class="lead" [innerHTML]="dsoTitle"></span>
97
<span class="text-muted">
108
<ds-truncatable-part [id]="dso.id" [minLines]="1">
119
<span *ngIf="dso.allMetadata(['person.jobTitle']).length > 0"

src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/person/person-search-result-list-element.component.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,4 @@ import { ItemSearchResultListElementComponent } from '../../../../../shared/obje
1313
* The component for displaying a list element for an item search result of the type Person
1414
*/
1515
export class PersonSearchResultListElementComponent extends ItemSearchResultListElementComponent {
16-
17-
get name() {
18-
return this.value ?
19-
this.value :
20-
this.firstMetadataValue('person.familyName') + ', ' + this.firstMetadataValue('person.givenName');
21-
}
2216
}

0 commit comments

Comments
 (0)