diff --git a/src/themes/qulto/app/item-page/full/full-item-page.component.html b/src/themes/qulto/app/item-page/full/full-item-page.component.html index bec88b6892b..19b5b20a6b9 100644 --- a/src/themes/qulto/app/item-page/full/full-item-page.component.html +++ b/src/themes/qulto/app/item-page/full/full-item-page.component.html @@ -30,7 +30,8 @@ @for (mdEntry of (metadata$ | async) | keyvalue; track mdEntry) { @for (mdValue of mdEntry.value; track mdValue) { - {{ mdEntry.key | translate }} + {{ mdEntry.key }} + {{ mdEntry.key | dsMetadataLabel | async }} {{ mdValue.value }} {{ mdValue.language }} diff --git a/src/themes/qulto/app/item-page/full/full-item-page.component.scss b/src/themes/qulto/app/item-page/full/full-item-page.component.scss new file mode 100644 index 00000000000..6939ca6badd --- /dev/null +++ b/src/themes/qulto/app/item-page/full/full-item-page.component.scss @@ -0,0 +1,9 @@ +:host { + // The full-item-page table has two label columns (raw metadata key + its + // translation). A long value cell (e.g. dc.description) would otherwise + // squeeze these, wrapping two-word labels like "Megjelenés dátuma". Keep the + // label columns on a single line; only the value column wraps. (QREPO-413) + td.metadata-label { + white-space: nowrap; + } +} diff --git a/src/themes/qulto/app/item-page/full/full-item-page.component.ts b/src/themes/qulto/app/item-page/full/full-item-page.component.ts index 83b661bc40c..72c2c3b0cc1 100644 --- a/src/themes/qulto/app/item-page/full/full-item-page.component.ts +++ b/src/themes/qulto/app/item-page/full/full-item-page.component.ts @@ -21,20 +21,22 @@ import { DsoEditMenuComponent } from '../../../../../app/shared/dso-page/dso-edi import { ErrorComponent } from '../../../../../app/shared/error/error.component'; import { ThemedLoadingComponent } from '../../../../../app/shared/loading/themed-loading.component'; import { VarDirective } from '../../../../../app/shared/utils/var.directive'; +import { MetadataLabelPipe } from '../../shared/utils/metadata-label.pipe'; /** - * Qulto full item page — renders the metadata as a translated table: - * the metadata field keys (e.g. `dc.title`) are passed through the translate - * pipe so the table headers show localised labels from the qulto/szerep i18n. - * The base template shows raw metadata keys instead. + * Qulto full item page — renders the metadata table with an extra column. + * Each row shows the raw metadata key (e.g. `dc.title`) AND, in a separate + * column, its localised label resolved via the `dsMetadataLabel` pipe (empty + * when no translation exists). The base template shows only the raw key. + * (QREPO-413) */ - @Component({ selector: 'ds-themed-full-item-page', - // styleUrls: ['./full-item-page.component.scss'], - styleUrls: ['../../../../../app/item-page/full/full-item-page.component.scss'], + styleUrls: [ + '../../../../../app/item-page/full/full-item-page.component.scss', + './full-item-page.component.scss', + ], templateUrl: './full-item-page.component.html', - // templateUrl: '../../../../../app/item-page/full/full-item-page.component.html', changeDetection: ChangeDetectionStrategy.OnPush, animations: [fadeInOut], imports: [ @@ -45,6 +47,7 @@ import { VarDirective } from '../../../../../app/shared/utils/var.directive'; ItemVersionsComponent, ItemVersionsNoticeComponent, KeyValuePipe, + MetadataLabelPipe, RouterLink, ThemedFullFileSectionComponent, ThemedItemAlertsComponent, diff --git a/src/themes/qulto/app/shared/utils/metadata-label.pipe.ts b/src/themes/qulto/app/shared/utils/metadata-label.pipe.ts new file mode 100644 index 00000000000..70fb10b0259 --- /dev/null +++ b/src/themes/qulto/app/shared/utils/metadata-label.pipe.ts @@ -0,0 +1,33 @@ +import { + inject, + Pipe, + PipeTransform, +} from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; + +/** + * Resolves a metadata field key (e.g. `dc.title`) to its localised label. + * + * Returns an empty string when no translation exists, so the full-item-page + * label column stays blank instead of echoing the raw key. Uses + * `translate.stream()` (combined with the async pipe in the template) so the + * label updates reactively on language change; the pipe itself is pure, so the + * stream is created once per key and cached — no per-change-detection work. This + * replaces the previous `getTranslation()` component method. (QREPO-413) + */ +@Pipe({ + name: 'dsMetadataLabel', +}) +export class MetadataLabelPipe implements PipeTransform { + + private translate = inject(TranslateService); + + transform(key: string): Observable { + return this.translate.stream(key).pipe( + map((translation: string) => (translation === key ? '' : translation)), + ); + } + +} diff --git a/src/themes/qulto/assets/i18n/en.json5 b/src/themes/qulto/assets/i18n/en.json5 index db76806c576..4fd4aad23b2 100644 --- a/src/themes/qulto/assets/i18n/en.json5 +++ b/src/themes/qulto/assets/i18n/en.json5 @@ -12,4 +12,35 @@ // Label for the Publication page author field (mixed-author-field). The qulto // publication override uses this key instead of base "item.page.authors". "relationships.isAuthorOf": "Authors", + + // The full-item-page table's translation column resolves the metadata key + // (mdEntry.key) via getTranslation(). The keys below are the basic fields of the + // traditional submission form (traditionalpageone + traditionalpagetwo). (QREPO-413) + "dc.contributor.author": "Author", + + "dc.title": "Title", + + "dc.title.alternative": "Other Titles", + + "dc.date.issued": "Date of Issue", + + "dc.publisher": "Publisher", + + "dc.identifier.citation": "Citation", + + "dc.relation.ispartofseries": "Series/Report No.", + + "dc.identifier": "Identifiers", + + "dc.type": "Type", + + "dc.language.iso": "Language", + + "dc.subject": "Subject Keywords", + + "dc.description.abstract": "Abstract", + + "dc.description.sponsorship": "Sponsors", + + "dc.description": "Description", } diff --git a/src/themes/qulto/assets/i18n/hu.json5 b/src/themes/qulto/assets/i18n/hu.json5 index 9dc5d0c79f1..56851294a80 100644 --- a/src/themes/qulto/assets/i18n/hu.json5 +++ b/src/themes/qulto/assets/i18n/hu.json5 @@ -14,4 +14,35 @@ "relationships.isAuthorOf": "Szerzők", "access-status.open.access.listelement.badge": "Szabadon hozzáférhető", + + // A full-item-page (teljes nézet) táblázat fordítás-oszlopa a metaadat-kulcsra + // (mdEntry.key) keres rá a getTranslation()-nel. Az alábbi kulcsok a traditional + // beküldő űrlap (traditionalpageone + traditionalpagetwo) alapmezői. (QREPO-413) + "dc.contributor.author": "Szerző", + + "dc.title": "Cím", + + "dc.title.alternative": "További címek", + + "dc.date.issued": "Megjelenés dátuma", + + "dc.publisher": "Kiadó", + + "dc.identifier.citation": "Bibliográfiai hivatkozás", + + "dc.relation.ispartofseries": "Sorozat / jelentésszám", + + "dc.identifier": "Azonosítók", + + "dc.type": "Típus", + + "dc.language.iso": "Nyelv", + + "dc.subject": "Tárgyszavak", + + "dc.description.abstract": "Absztrakt", + + "dc.description.sponsorship": "Támogatók", + + "dc.description": "Leírás", } diff --git a/src/themes/szerep/app/item-page/full/full-item-page.component.html b/src/themes/szerep/app/item-page/full/full-item-page.component.html deleted file mode 100644 index 0db982bad98..00000000000 --- a/src/themes/szerep/app/item-page/full/full-item-page.component.html +++ /dev/null @@ -1,60 +0,0 @@ -
- @if (itemRD?.hasSucceeded) { -
- @if (itemRD?.payload; as item) { -
- - - @if (!item.isWithdrawn || (isAdmin$|async)) { -
-
- - -
- @if (!fromSubmissionObject) { - - } -
- - - @for (mdEntry of (metadata$ | async) | keyvalue; track mdEntry) { - @for (mdValue of mdEntry.value; track mdValue) { - - - - - - - } - } - -
{{ mdEntry.key | translate }}{{mdValue.value}}{{mdValue.language}}
-
- - - - @if (fromSubmissionObject) { -
-
- -
-
- } -
- } -
- } -
- } - @if (itemRD?.hasFailed) { - - } - @if (itemRD?.isLoading) { - - } -
diff --git a/src/themes/szerep/app/item-page/full/full-item-page.component.ts b/src/themes/szerep/app/item-page/full/full-item-page.component.ts deleted file mode 100644 index f023d178066..00000000000 --- a/src/themes/szerep/app/item-page/full/full-item-page.component.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { - AsyncPipe, - KeyValuePipe, -} from '@angular/common'; -import { - ChangeDetectionStrategy, - Component, -} from '@angular/core'; -import { RouterLink } from '@angular/router'; -import { TranslateModule } from '@ngx-translate/core'; - -import { ThemedItemAlertsComponent } from '../../../../../app/item-page/alerts/themed-item-alerts.component'; -import { CollectionsComponent } from '../../../../../app/item-page/field-components/collections/collections.component'; -import { ThemedFullFileSectionComponent } from '../../../../../app/item-page/full/field-components/file-section/themed-full-file-section.component'; -import { FullItemPageComponent as BaseComponent } from '../../../../../app/item-page/full/full-item-page.component'; -import { ThemedItemPageTitleFieldComponent } from '../../../../../app/item-page/simple/field-components/specific-field/title/themed-item-page-field.component'; -import { ItemVersionsComponent } from '../../../../../app/item-page/versions/item-versions.component'; -import { ItemVersionsNoticeComponent } from '../../../../../app/item-page/versions/notice/item-versions-notice.component'; -import { fadeInOut } from '../../../../../app/shared/animations/fade'; -import { DsoEditMenuComponent } from '../../../../../app/shared/dso-page/dso-edit-menu/dso-edit-menu.component'; -import { ErrorComponent } from '../../../../../app/shared/error/error.component'; -import { ThemedLoadingComponent } from '../../../../../app/shared/loading/themed-loading.component'; -import { VarDirective } from '../../../../../app/shared/utils/var.directive'; - -/** - * SZEREP full item page — identical to the base, but uses a local template that - * translates the metadata field keys in the table view. The labels come from the - * szerep i18n (e.g. dc.title → "Cím"); the base template shows the raw keys. - */ -@Component({ - selector: 'ds-themed-full-item-page', - styleUrls: ['../../../../../app/item-page/full/full-item-page.component.scss'], - templateUrl: './full-item-page.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, - animations: [fadeInOut], - imports: [ - AsyncPipe, - CollectionsComponent, - DsoEditMenuComponent, - ErrorComponent, - ItemVersionsComponent, - ItemVersionsNoticeComponent, - KeyValuePipe, - RouterLink, - ThemedFullFileSectionComponent, - ThemedItemAlertsComponent, - ThemedItemPageTitleFieldComponent, - ThemedLoadingComponent, - TranslateModule, - VarDirective, - ], -}) -export class FullItemPageComponent extends BaseComponent { -} diff --git a/src/themes/szerep/assets/i18n/en.json5 b/src/themes/szerep/assets/i18n/en.json5 index 5b96c2a7c3d..52c9a5cba2b 100644 --- a/src/themes/szerep/assets/i18n/en.json5 +++ b/src/themes/szerep/assets/i18n/en.json5 @@ -25,14 +25,13 @@ "browse.search-form.placeholder": "Enter the first few characters", + // SZEREP-specific metadata labels that DIFFER from the qulto base or exist only + // here. Keys identical to qulto (dc.title, dc.contributor.author, dc.language.iso) + // were removed — they are inherited from the qulto theme i18n. (QREPO-413) "dc.title.subtitle": "Subtitle", "dc.title.other": "Other title", - "dc.title": "Title", - - "dc.contributor.author": "Author", - "dc.contributor.advisor": "Advisor", "dc.contributor.description": "Description", @@ -61,8 +60,6 @@ "dc.identifier.uri": "URI", - "dc.language.iso": "Language", - "dc.rights.access": "Access", "dc.subject": "Subject", diff --git a/src/themes/szerep/assets/i18n/hu.json5 b/src/themes/szerep/assets/i18n/hu.json5 index cd8f87396dc..08c79b330f1 100644 --- a/src/themes/szerep/assets/i18n/hu.json5 +++ b/src/themes/szerep/assets/i18n/hu.json5 @@ -39,14 +39,13 @@ "browse.search-form.placeholder": "Adja meg az első pár karaktert", + // SZEREP-specifikus metaadat-címkék, amelyek ELTÉRNEK a qulto alapfordításától + // vagy csak itt léteznek. A qulto-val azonos kulcsok (dc.title, dc.contributor.author, + // dc.language.iso) ki lettek véve — azok a qulto téma i18n-jéből öröklődnek. (QREPO-413) "dc.title.subtitle": "Alcím", "dc.title.other": "Egyéb cím", - "dc.title": "Cím", - - "dc.contributor.author": "Szerző", - "dc.contributor.advisor": "Konzulens/Témavezető", "dc.contributor.description": "Leírás", @@ -75,18 +74,12 @@ "dc.identifier.uri": "URI", - "dc.language.iso": "Nyelv", - "dc.rights.access": "Hozzáférés", "dc.subject": "Tárgyszó", "dc.type": "Dokumentumtípus", - "dc.title": "Cím", - - "dc.title.other": "Egyéb cím", - "dc.format.extent": "Terjedelem", "dc.identifier.doi": "DOI",