Skip to content

Commit

Permalink
document: fix collection display
Browse files Browse the repository at this point in the history
The `partOf` (collection) fields is now displayed as a main title.

Co-authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
  • Loading branch information
jma committed Aug 24, 2022
1 parent 4b7ea13 commit 0e0b5cc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,22 +253,6 @@ export class DocumentDetailViewComponent implements DetailRecord, OnInit, OnDest
}
}

/**
* Get short main title
* @param titles - document titles
* @return - main title to display
*/
getShortMainTitle(titles: any) {
const bfTitles: Array<any> = titles.filter((title: any) => title.type === 'bf:Title');
for (const bfTitle of bfTitles) {
for (const mainTitle of bfTitle.mainTitle) {
if (!mainTitle.language) {
return mainTitle.value;
}
}
}
}

contributionTypeParam(contribution: any) {
switch (contribution.type) {
case 'bf:Person':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
<b>{{ getPartOfLabel(hostDocument) }}</b>:
<ng-container *ngIf="isPublicView; else adminLink">
<a id="{{ 'doc-part-of-' + i }}" href="/{{ viewcode }}/documents/{{ partOf.document.pid }}">
{{ getShortMainTitle(hostDocument.metadata.title) }}
{{ hostDocument.metadata.title | mainTitle }}
</a>
</ng-container>
<ng-template #adminLink>
<a id="{{ 'doc-part-of-' + i }}" [routerLink]="['/records', 'documents', 'detail', partOf.document.pid]">
{{ getShortMainTitle(hostDocument.metadata.title) }}
{{ hostDocument.metadata.title | mainTitle }}
</a>
</ng-template>
<ng-container *ngIf="partOf.numbering">
Expand Down Expand Up @@ -58,12 +58,12 @@
<div class="row">
<ng-container *ngIf="isPublicView; else adminLink">
<a id="{{ 'doc-part-of-' + i }}" href="/{{ viewcode }}/documents/{{ document.document.pid }}">
{{ getShortMainTitle(hostDocument.metadata.title) }}
{{ hostDocument.metadata.title | mainTitle }}
</a>
</ng-container>
<ng-template #adminLink>
<a id="{{ 'doc-part-of-' + i }}" [routerLink]="['/records', 'documents', 'detail', document.document.pid]">
{{ getShortMainTitle(hostDocument.metadata.title) }}
{{ hostDocument.metadata.title | mainTitle }}
</a>
</ng-template>
<ng-container *ngIf="document.numbering">
Expand Down
16 changes: 0 additions & 16 deletions projects/shared/src/lib/view/brief/part-of/part-of.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,6 @@ export class PartOfComponent {
}
}

/**
* Get short main title
* @param titles - document titles
* @return - main title to display
*/
getShortMainTitle(titles: any) {
const bfTitles: Array<any> = titles.filter((title: any) => title.type === 'bf:Title');
for (const bfTitle of bfTitles) {
for (const mainTitle of bfTitle.mainTitle) {
if (!mainTitle.language) {
return mainTitle.value;
}
}
}
}

/**
* Format "part of" numbering for display
*
Expand Down

0 comments on commit 0e0b5cc

Please sign in to comment.