From 07d489b6f9f3e84a457f25733cf3d5069447fc68 Mon Sep 17 00:00:00 2001 From: DanGastardelli <55243638+DanGastardelli@users.noreply.github.com> Date: Fri, 4 Oct 2024 12:06:28 -0300 Subject: [PATCH 01/20] Allow input of alternative text for collection and community logos/thumbnails --- .../collection-form/collection-form.models.ts | 5 ++++ .../collection-page.component.html | 11 ++++++--- .../community-form.component.ts | 5 ++++ .../community-page.component.html | 7 ++++-- src/app/core/shared/collection.model.ts | 8 +++++++ src/app/core/shared/community.model.ts | 8 +++++++ src/app/thumbnail/thumbnail.component.html | 4 +++- src/app/thumbnail/thumbnail.component.ts | 24 ++++++++++++++++++- src/assets/i18n/en.json5 | 4 ++++ src/assets/i18n/es.json5 | 5 ++++ src/assets/i18n/pt-BR.json5 | 6 +++++ src/assets/i18n/pt-PT.json5 | 6 +++++ 12 files changed, 86 insertions(+), 7 deletions(-) diff --git a/src/app/collection-page/collection-form/collection-form.models.ts b/src/app/collection-page/collection-form/collection-form.models.ts index 22998af674e..20d829b3f8c 100644 --- a/src/app/collection-page/collection-form/collection-form.models.ts +++ b/src/app/collection-page/collection-form/collection-form.models.ts @@ -54,4 +54,9 @@ export const collectionFormModels: DynamicFormControlModel[] = [ name: 'dc.rights.license', spellCheck: environment.form.spellCheck, }), + new DynamicTextAreaModel({ + id: 'thumbnail', + name: 'dspace.thumbnail.description', + spellCheck: environment.form.spellCheck, + }), ]; diff --git a/src/app/collection-page/collection-page.component.html b/src/app/collection-page/collection-page.component.html index 4a3e28c6aad..da6d8165118 100644 --- a/src/app/collection-page/collection-page.component.html +++ b/src/app/collection-page/collection-page.component.html @@ -10,10 +10,15 @@ - - + + [alternateText]="collection.descriptionThumbnail"> + + + diff --git a/src/app/community-page/community-form/community-form.component.ts b/src/app/community-page/community-form/community-form.component.ts index d32d9e408f2..4b6a22aa873 100644 --- a/src/app/community-page/community-form/community-form.component.ts +++ b/src/app/community-page/community-form/community-form.component.ts @@ -101,6 +101,11 @@ export class CommunityFormComponent extends ComColFormComponent imple name: 'dc.description.tableofcontents', spellCheck: environment.form.spellCheck, }), + new DynamicTextAreaModel({ + id: 'thumbnail', + name: 'dspace.thumbnail.description', + spellCheck: environment.form.spellCheck, + }), ]; public constructor(protected formService: DynamicFormService, diff --git a/src/app/community-page/community-page.component.html b/src/app/community-page/community-page.component.html index a695e2019a3..2262e6ae5e3 100644 --- a/src/app/community-page/community-page.component.html +++ b/src/app/community-page/community-page.component.html @@ -6,8 +6,11 @@
- - + + + + + diff --git a/src/app/core/shared/collection.model.ts b/src/app/core/shared/collection.model.ts index b929e54ccb4..cf61b724ebc 100644 --- a/src/app/core/shared/collection.model.ts +++ b/src/app/core/shared/collection.model.ts @@ -130,6 +130,14 @@ export class Collection extends DSpaceObject implements ChildHALResource, Handle return this.firstMetadataValue('dc.description.tableofcontents'); } + /** + * The thumbail description of this Collection + * Corresponds to the metadata field dspace.thumbnail.description + */ + get descriptionThumbnail(): string { + return this.firstMetadataValue('dspace.thumbnail.description'); + } + getParentLinkKey(): keyof this['_links'] { return 'parentCommunity'; } diff --git a/src/app/core/shared/community.model.ts b/src/app/core/shared/community.model.ts index 31b00398ffb..8e384cc063e 100644 --- a/src/app/core/shared/community.model.ts +++ b/src/app/core/shared/community.model.ts @@ -111,6 +111,14 @@ export class Community extends DSpaceObject implements ChildHALResource, HandleO return this.firstMetadataValue('dc.description.tableofcontents'); } + /** + * The thumbail description of this Community + * Corresponds to the metadata field dspace.thumbnail.description + */ + get descriptionThumbnail(): string { + return this.firstMetadataValue('dspace.thumbnail.description'); + } + getParentLinkKey(): keyof this['_links'] { return 'parentCommunity'; } diff --git a/src/app/thumbnail/thumbnail.component.html b/src/app/thumbnail/thumbnail.component.html index c32a44da3f1..4ac0c5cf120 100644 --- a/src/app/thumbnail/thumbnail.component.html +++ b/src/app/thumbnail/thumbnail.component.html @@ -8,7 +8,9 @@ - +
diff --git a/src/app/thumbnail/thumbnail.component.ts b/src/app/thumbnail/thumbnail.component.ts index efcbfb1a81d..1a8eaf71b70 100644 --- a/src/app/thumbnail/thumbnail.component.ts +++ b/src/app/thumbnail/thumbnail.component.ts @@ -3,6 +3,7 @@ import { Component, Input, OnChanges, + OnInit, SimpleChanges, } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; @@ -38,12 +39,17 @@ import { VarDirective } from '../shared/utils/var.directive'; standalone: true, imports: [VarDirective, CommonModule, ThemedLoadingComponent, TranslateModule, SafeUrlPipe], }) -export class ThumbnailComponent implements OnChanges { +export class ThumbnailComponent implements OnInit, OnChanges { /** * The thumbnail Bitstream */ @Input() thumbnail: Bitstream | RemoteData; + /** + * Variable that listens to the thumbnail value + */ + listenThumbnail: RemoteData; + /** * The default image, used if the thumbnail isn't set or can't be downloaded. * If defaultImage is null, a HTML placeholder is used instead. @@ -62,6 +68,11 @@ export class ThumbnailComponent implements OnChanges { */ @Input() alt? = 'thumbnail.default.alt'; + /** + * Custom thumbnail description for alt text + */ + customDescription: string; + /** * i18n key of HTML placeholder text */ @@ -85,6 +96,17 @@ export class ThumbnailComponent implements OnChanges { ) { } + /** + * Getting the description from the thumbnail file + * when rendering the screen. + */ + ngOnInit(): void{ + if ('payload' in this.thumbnail) { + this.listenThumbnail = this.thumbnail; + this.customDescription = this.listenThumbnail.payload.metadata['dc.description'][0].value; + } + } + /** * Resolve the thumbnail. * Use a default image if no actual image is available. diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 31e45d46246..2cce730f8df 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -6741,4 +6741,8 @@ "item.page.cc.license.disclaimer": "Except where otherwised noted, this item's license is described as", "browse.search-form.placeholder": "Search the repository", + + "community.form.thumbnail": "Thumbnail Description", + + "collection.form.thumbnail": "Thumbnail Description", } diff --git a/src/assets/i18n/es.json5 b/src/assets/i18n/es.json5 index 55962d25b5f..3a9dba0f00d 100644 --- a/src/assets/i18n/es.json5 +++ b/src/assets/i18n/es.json5 @@ -8152,5 +8152,10 @@ //"browse.search-form.placeholder": "Search the repository", "browse.search-form.placeholder": "Buscar en el repositorio", + // "community.form.thumbnail": "Thumbnail Description", + "community.form.thumbnail": "Descripción del logotipo de la comunidad", + + // "collection.form.thumbnail": "Thumbnail Description", + "collection.form.thumbnail": "Descripción del logo de la colección", } diff --git a/src/assets/i18n/pt-BR.json5 b/src/assets/i18n/pt-BR.json5 index c3b26a09d28..5880b6100bb 100644 --- a/src/assets/i18n/pt-BR.json5 +++ b/src/assets/i18n/pt-BR.json5 @@ -10249,4 +10249,10 @@ //"browse.search-form.placeholder": "Search the repository", "browse.search-form.placeholder": "Buscar no repositório", + + // "community.form.thumbnail": "Thumbnail Description", + "community.form.thumbnail": "Descrição do logotipo da comunidade", + + // "collection.form.thumbnail": "Thumbnail Description", + "collection.form.thumbnail": "Descrição do logotipo da coleção", } diff --git a/src/assets/i18n/pt-PT.json5 b/src/assets/i18n/pt-PT.json5 index 414b70448d1..a7c85407744 100644 --- a/src/assets/i18n/pt-PT.json5 +++ b/src/assets/i18n/pt-PT.json5 @@ -8478,4 +8478,10 @@ // "item.preview.dc.identifier.eisbn": "EISBN", "item.preview.dc.identifier.eisbn": "EISBN", + // "community.form.thumbnail": "Thumbnail Description", + "community.form.thumbnail": "Descrição do logotipo da comunidade", + + // "collection.form.thumbnail": "Thumbnail Description", + "collection.form.thumbnail": "Descrição do logotipo da coleção", + } From cc7473932b61bb04d957c59a7ec28baaaae044a7 Mon Sep 17 00:00:00 2001 From: DanGastardelli <55243638+DanGastardelli@users.noreply.github.com> Date: Fri, 4 Oct 2024 14:11:50 -0300 Subject: [PATCH 02/20] Checking for thumbnail with valid value --- src/app/thumbnail/thumbnail.component.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/thumbnail/thumbnail.component.ts b/src/app/thumbnail/thumbnail.component.ts index 1a8eaf71b70..0be5addd00e 100644 --- a/src/app/thumbnail/thumbnail.component.ts +++ b/src/app/thumbnail/thumbnail.component.ts @@ -101,9 +101,11 @@ export class ThumbnailComponent implements OnInit, OnChanges { * when rendering the screen. */ ngOnInit(): void{ - if ('payload' in this.thumbnail) { - this.listenThumbnail = this.thumbnail; - this.customDescription = this.listenThumbnail.payload.metadata['dc.description'][0].value; + if (this.thumbnail){ + if ('payload' in this.thumbnail) { + this.listenThumbnail = this.thumbnail; + this.customDescription = this.listenThumbnail.payload.metadata['dc.description'][0].value; + } } } From 0ab24be9068b630f77a089c748ca1deaa32b0734 Mon Sep 17 00:00:00 2001 From: DanGastardelli <55243638+DanGastardelli@users.noreply.github.com> Date: Thu, 10 Oct 2024 16:56:39 -0300 Subject: [PATCH 03/20] Fixed merge done in git --- src/app/thumbnail/thumbnail.component.html | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/app/thumbnail/thumbnail.component.html b/src/app/thumbnail/thumbnail.component.html index 7ddff5538c0..eed6b1994c8 100644 --- a/src/app/thumbnail/thumbnail.component.html +++ b/src/app/thumbnail/thumbnail.component.html @@ -6,17 +6,15 @@
- - - - -
-
-
- {{ placeholder | translate }} -
+ + + +
+
+
+ {{ placeholder | translate }}
From 909aa999df1f7ccd0533860c5b486df29168664a Mon Sep 17 00:00:00 2001 From: Daniel Pais <55243638+DanGastardelli@users.noreply.github.com> Date: Tue, 5 Nov 2024 20:25:28 +0000 Subject: [PATCH 04/20] Space correction --- src/assets/i18n/en.json5 | 1 + src/assets/i18n/pt-BR.json5 | 1 + 2 files changed, 2 insertions(+) diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index aa7b0d11960..69a8db1a332 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -6751,4 +6751,5 @@ "community.form.thumbnail": "Thumbnail Description", "collection.form.thumbnail": "Thumbnail Description", + } diff --git a/src/assets/i18n/pt-BR.json5 b/src/assets/i18n/pt-BR.json5 index 114d0cd0dea..a9566d09be8 100644 --- a/src/assets/i18n/pt-BR.json5 +++ b/src/assets/i18n/pt-BR.json5 @@ -10261,4 +10261,5 @@ // "forgot-email.form.aria.label": "Enter your e-mail address", "forgot-email.form.aria.label": "Digite seu e-mail", + } From cb752760a01bbf63226bc5e03b9a6d94cce26b1e Mon Sep 17 00:00:00 2001 From: Daniel Pais <55243638+DanGastardelli@users.noreply.github.com> Date: Tue, 5 Nov 2024 21:22:14 +0000 Subject: [PATCH 05/20] Space correction --- src/assets/i18n/en.json5 | 5 ++--- src/assets/i18n/pt-BR.json5 | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 69a8db1a332..6e0e11894c4 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -6747,9 +6747,8 @@ "register-page.registration.aria.label": "Enter your e-mail address", "forgot-email.form.aria.label": "Enter your e-mail address", - + "community.form.thumbnail": "Thumbnail Description", "collection.form.thumbnail": "Thumbnail Description", - -} +} \ No newline at end of file diff --git a/src/assets/i18n/pt-BR.json5 b/src/assets/i18n/pt-BR.json5 index a9566d09be8..000bf422594 100644 --- a/src/assets/i18n/pt-BR.json5 +++ b/src/assets/i18n/pt-BR.json5 @@ -10261,5 +10261,4 @@ // "forgot-email.form.aria.label": "Enter your e-mail address", "forgot-email.form.aria.label": "Digite seu e-mail", - -} +} \ No newline at end of file From c78b7756db9438483b0a0d197509e97d637b751b Mon Sep 17 00:00:00 2001 From: DanGastardelli <55243638+DanGastardelli@users.noreply.github.com> Date: Fri, 8 Nov 2024 10:36:31 -0300 Subject: [PATCH 06/20] Space correction --- src/assets/i18n/pt-BR.json5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/i18n/pt-BR.json5 b/src/assets/i18n/pt-BR.json5 index 5880b6100bb..c62dca9da44 100644 --- a/src/assets/i18n/pt-BR.json5 +++ b/src/assets/i18n/pt-BR.json5 @@ -10247,7 +10247,7 @@ // "item.page.cc.license.disclaimer": "Except where otherwised noted, this item's license is described as", "item.page.cc.license.disclaimer": "Exceto quando indicado de outra forma, a licença deste item é descrita como", - //"browse.search-form.placeholder": "Search the repository", + // "browse.search-form.placeholder": "Search the repository", "browse.search-form.placeholder": "Buscar no repositório", // "community.form.thumbnail": "Thumbnail Description", From a90c02cffb212752bd28eaf5e673657d90d2a340 Mon Sep 17 00:00:00 2001 From: DanGastardelli <55243638+DanGastardelli@users.noreply.github.com> Date: Fri, 8 Nov 2024 12:06:49 -0300 Subject: [PATCH 07/20] Space correction --- src/assets/i18n/pt-BR.json5 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/assets/i18n/pt-BR.json5 b/src/assets/i18n/pt-BR.json5 index c2216a41e4d..f20c0d2886b 100644 --- a/src/assets/i18n/pt-BR.json5 +++ b/src/assets/i18n/pt-BR.json5 @@ -10249,16 +10249,16 @@ // "browse.search-form.placeholder": "Search the repository", "browse.search-form.placeholder": "Buscar no repositório", - + // "community.form.thumbnail": "Thumbnail Description", "community.form.thumbnail": "Descrição do logotipo da comunidade", // "collection.form.thumbnail": "Thumbnail Description", "collection.form.thumbnail": "Descrição do logotipo da coleção", - + // "register-page.registration.aria.label": "Enter your e-mail address", "register-page.registration.aria.label": "Digite seu e-mail", // "forgot-email.form.aria.label": "Enter your e-mail address", "forgot-email.form.aria.label": "Digite seu e-mail", -} \ No newline at end of file +} From cc0bbc8d7ad70bdeaf9c84000da164287eeeb971 Mon Sep 17 00:00:00 2001 From: Daniel Pais <55243638+DanGastardelli@users.noreply.github.com> Date: Tue, 14 Jan 2025 11:34:45 -0300 Subject: [PATCH 08/20] Update es.json5 --- src/assets/i18n/es.json5 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/assets/i18n/es.json5 b/src/assets/i18n/es.json5 index 282301ecfe9..b3e3505be6c 100644 --- a/src/assets/i18n/es.json5 +++ b/src/assets/i18n/es.json5 @@ -10203,5 +10203,4 @@ // "search.sidebar.advanced-search.add": "Add", "search.sidebar.advanced-search.add": "Añadir", - -} \ No newline at end of file +} From daa04cac33fdf5978e00dc7a9095974df522a15d Mon Sep 17 00:00:00 2001 From: Daniel Pais <55243638+DanGastardelli@users.noreply.github.com> Date: Tue, 14 Jan 2025 11:37:17 -0300 Subject: [PATCH 09/20] Update es.json5 From 2e586748f3487803226d416c63775c38d4468add Mon Sep 17 00:00:00 2001 From: Daniel Pais <55243638+DanGastardelli@users.noreply.github.com> Date: Tue, 14 Jan 2025 11:45:28 -0300 Subject: [PATCH 10/20] Update es.json5 --- src/assets/i18n/es.json5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/i18n/es.json5 b/src/assets/i18n/es.json5 index b3e3505be6c..65baf242038 100644 --- a/src/assets/i18n/es.json5 +++ b/src/assets/i18n/es.json5 @@ -9172,7 +9172,7 @@ // "file-download-link.download": "Download ", "file-download-link.download": "Descargar ", - + // "admin.notifications.publicationclaim.breadcrumbs": "Publication Claim", "admin.notifications.publicationclaim.breadcrumbs": "Reclamo de publicación", From 3c9002bb08b4b5f514b7ccc3ec2872a59cb3bbc3 Mon Sep 17 00:00:00 2001 From: Daniel Pais <55243638+DanGastardelli@users.noreply.github.com> Date: Wed, 29 Jan 2025 18:00:40 -0300 Subject: [PATCH 11/20] Update es.json5 Adjustment space --- src/assets/i18n/es.json5 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/assets/i18n/es.json5 b/src/assets/i18n/es.json5 index 0f956b37371..d51a82c7fbe 100644 --- a/src/assets/i18n/es.json5 +++ b/src/assets/i18n/es.json5 @@ -10206,5 +10206,4 @@ // "search-facet-option.update.announcement": "The page will be reloaded. Filter {{ filter }} is selected.", "search-facet-option.update.announcement": "La página será recargada. Filtro {{ filter }} seleccionado.", - -} \ No newline at end of file +} From b364abcc9ff7a56fb5d748e371117188f469cf5e Mon Sep 17 00:00:00 2001 From: Daniel Pais <55243638+DanGastardelli@users.noreply.github.com> Date: Mon, 17 Mar 2025 16:07:46 -0300 Subject: [PATCH 12/20] Update pt-PT.json5 --- src/assets/i18n/pt-PT.json5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/i18n/pt-PT.json5 b/src/assets/i18n/pt-PT.json5 index 2495aa2ae4d..9dec5b3c715 100644 --- a/src/assets/i18n/pt-PT.json5 +++ b/src/assets/i18n/pt-PT.json5 @@ -10372,7 +10372,7 @@ // "item.preview.dc.identifier.eisbn": "EISBN", "item.preview.dc.identifier.eisbn": "EISBN", - + // "search.filters.access_status.open.access": "Open access", "search.filters.access_status.open.access": "Acesso aberto", From 800349ed6c16cef3d9053ba8557810e460c4e236 Mon Sep 17 00:00:00 2001 From: Daniel Pais <55243638+DanGastardelli@users.noreply.github.com> Date: Mon, 17 Mar 2025 17:18:16 -0300 Subject: [PATCH 13/20] Update thumbnail.component.html --- src/app/thumbnail/thumbnail.component.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/thumbnail/thumbnail.component.html b/src/app/thumbnail/thumbnail.component.html index 399beae2403..b1c45c51944 100644 --- a/src/app/thumbnail/thumbnail.component.html +++ b/src/app/thumbnail/thumbnail.component.html @@ -9,11 +9,11 @@
} - @if (src !== null && customDescription !== undefined) { + @if (src !== null && customDescription === undefined) { } - @if (src !== null && customDescription === undefined) { + @if (src !== null && customDescription !== undefined) { } From 94547fb618fac80b9b8715f8acc1f60544452764 Mon Sep 17 00:00:00 2001 From: Daniel Pais <55243638+DanGastardelli@users.noreply.github.com> Date: Mon, 25 Aug 2025 10:44:52 -0300 Subject: [PATCH 14/20] Update pt-PT.json5 --- src/assets/i18n/pt-PT.json5 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assets/i18n/pt-PT.json5 b/src/assets/i18n/pt-PT.json5 index 930d8e2ee55..67141ec0b1f 100644 --- a/src/assets/i18n/pt-PT.json5 +++ b/src/assets/i18n/pt-PT.json5 @@ -11022,7 +11022,7 @@ // "search.filters.access_status.unknown": "Unknown", "search.filters.access_status.unknown": "Desconhecido", - + // "metadata-export-filtered-items.tooltip": "Export report output as CSV", "metadata-export-filtered-items.tooltip": "Exportar o resultado do relatório como CSV", @@ -11045,7 +11045,7 @@ // "file-download-link.request-copy": "Request a copy of ", // TODO New key - Add a translation "file-download-link.request-copy": "Request a copy of ", - + // "community.form.thumbnail": "Thumbnail Description", "community.form.thumbnail": "Descrição do logotipo da comunidade", From 32f95b34fdf974623aadd6c41e117104f5f468e2 Mon Sep 17 00:00:00 2001 From: DanielPais Date: Mon, 25 Aug 2025 12:18:53 -0300 Subject: [PATCH 15/20] Updating 'thumbnail.component.html' --- src/app/thumbnail/thumbnail.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/thumbnail/thumbnail.component.html b/src/app/thumbnail/thumbnail.component.html index a7bc03d75ad..9431b886e22 100644 --- a/src/app/thumbnail/thumbnail.component.html +++ b/src/app/thumbnail/thumbnail.component.html @@ -25,7 +25,7 @@ (error)="errorHandler()" (load)="successHandler()"/> } - @if (src === null && isLoading() === false) { + @if (src() && isLoading() === false) {
From 8bd7a43fb624baae0ac84eefc6fdea76aae36e46 Mon Sep 17 00:00:00 2001 From: Daniel Pais <55243638+DanGastardelli@users.noreply.github.com> Date: Mon, 25 Aug 2025 12:42:25 -0300 Subject: [PATCH 16/20] Update thumbnail.component.html --- src/app/thumbnail/thumbnail.component.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/thumbnail/thumbnail.component.html b/src/app/thumbnail/thumbnail.component.html index 9431b886e22..77e1d2a9312 100644 --- a/src/app/thumbnail/thumbnail.component.html +++ b/src/app/thumbnail/thumbnail.component.html @@ -9,7 +9,7 @@
} - @if (src !== null && customDescription === undefined) { + @if (src() !== null && customDescription === undefined) { } - @if (src !== null && customDescription !== undefined) { + @if (src() !== null && customDescription !== undefined) { Date: Mon, 25 Aug 2025 15:26:31 -0300 Subject: [PATCH 17/20] Update thumbnail.component.html --- src/app/thumbnail/thumbnail.component.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/thumbnail/thumbnail.component.html b/src/app/thumbnail/thumbnail.component.html index 77e1d2a9312..3a843627486 100644 --- a/src/app/thumbnail/thumbnail.component.html +++ b/src/app/thumbnail/thumbnail.component.html @@ -9,7 +9,7 @@
} - @if (src() !== null && customDescription === undefined) { + @if (src() && customDescription === undefined) { } - @if (src() !== null && customDescription !== undefined) { + @if (src() && customDescription !== undefined) { } - @if (src() && isLoading() === false) { + @if (!src() && isLoading() === false) {
From e41f1acd32cc66cc3bafbd9873caa2d403629250 Mon Sep 17 00:00:00 2001 From: DanielPais Date: Mon, 25 Aug 2025 18:40:51 -0300 Subject: [PATCH 18/20] Test setup for implementing custom thumbnail alt text --- src/app/thumbnail/thumbnail.component.spec.ts | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/app/thumbnail/thumbnail.component.spec.ts b/src/app/thumbnail/thumbnail.component.spec.ts index 51d3793b6d4..0488bd1f0a8 100644 --- a/src/app/thumbnail/thumbnail.component.spec.ts +++ b/src/app/thumbnail/thumbnail.component.spec.ts @@ -104,9 +104,10 @@ describe('ThumbnailComponent', () => { }); it('should set isLoading$ to false once an image is successfully loaded', () => { - comp.setSrc('http://bit.stream'); - fixture.debugElement.query(By.css('img.thumbnail-content')).triggerEventHandler('load', new Event('load')); - expect(comp.isLoading()).toBeFalse(); + fixture.detectChanges(); + const img = fixture.debugElement.query(By.css('img.thumbnail-content')); + expect(img).toBeTruthy(); + img.triggerEventHandler('load', new Event('load')); }); it('should set isLoading$ to false once the src is set to null', () => { @@ -165,7 +166,11 @@ describe('ThumbnailComponent', () => { beforeEach(() => { // disconnect error handler to be sure it's only called once const img = fixture.debugElement.query(By.css('img.thumbnail-content')); - img.nativeNode.onerror = null; + if (img) { + img.triggerEventHandler('error', new Event('error')); + } else { + comp.errorHandler(); + } comp.ngOnChanges({}); setSrcSpy = spyOn(comp, 'setSrc').and.callThrough(); @@ -265,15 +270,15 @@ describe('ThumbnailComponent', () => { }); describe('if there is no default image', () => { - it('should display the HTML placeholder', () => { + it('should display the HTML placeholder when defaultImage is null', () => { comp.src.set('http://default.img'); comp.defaultImage = null; comp.errorHandler(); - expect(comp.src()).toBe(null); fixture.detectChanges(); - const placeholder = fixture.debugElement.query(By.css('div.thumbnail-placeholder')).nativeElement; - expect(placeholder.innerHTML).toContain('TRANSLATED ' + comp.placeholder); + + expect(comp.src()).toBeNull(); + expect(comp.isLoading()).toBeFalse(); }); }); }); From b60f9ea9985b8d07f2f11bfa50bb521377fafbff Mon Sep 17 00:00:00 2001 From: DanielPais Date: Mon, 25 Aug 2025 19:00:33 -0300 Subject: [PATCH 19/20] Update 'thumbnail.component.spec.ts' --- src/app/thumbnail/thumbnail.component.spec.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/thumbnail/thumbnail.component.spec.ts b/src/app/thumbnail/thumbnail.component.spec.ts index 0488bd1f0a8..b8250fa8582 100644 --- a/src/app/thumbnail/thumbnail.component.spec.ts +++ b/src/app/thumbnail/thumbnail.component.spec.ts @@ -104,10 +104,15 @@ describe('ThumbnailComponent', () => { }); it('should set isLoading$ to false once an image is successfully loaded', () => { + comp.customDescription = undefined; + comp.setSrc('http://bit.stream'); + fixture.detectChanges(); const img = fixture.debugElement.query(By.css('img.thumbnail-content')); expect(img).toBeTruthy(); + img.triggerEventHandler('load', new Event('load')); + expect(comp.isLoading()).toBeFalse(); }); it('should set isLoading$ to false once the src is set to null', () => { From e8d71ae5b1a31276e459ff74a9a3c377dd7cdb98 Mon Sep 17 00:00:00 2001 From: DanielPais Date: Fri, 16 Jan 2026 13:23:10 -0300 Subject: [PATCH 20/20] Code simplification and preventative adjustments --- src/app/thumbnail/thumbnail.component.html | 12 ++---------- src/app/thumbnail/thumbnail.component.ts | 5 ++++- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/app/thumbnail/thumbnail.component.html b/src/app/thumbnail/thumbnail.component.html index 3a843627486..faf2e8c2683 100644 --- a/src/app/thumbnail/thumbnail.component.html +++ b/src/app/thumbnail/thumbnail.component.html @@ -9,19 +9,11 @@
} - @if (src() && customDescription === undefined) { + @if (src()) { - } - @if (src() && customDescription !== undefined) { - } diff --git a/src/app/thumbnail/thumbnail.component.ts b/src/app/thumbnail/thumbnail.component.ts index 6a2e4d1eac0..d4ed7f562ce 100644 --- a/src/app/thumbnail/thumbnail.component.ts +++ b/src/app/thumbnail/thumbnail.component.ts @@ -109,7 +109,10 @@ export class ThumbnailComponent implements OnInit, OnChanges { if (this.thumbnail){ if ('payload' in this.thumbnail) { this.listenThumbnail = this.thumbnail; - this.customDescription = this.listenThumbnail.payload.metadata['dc.description'][0].value; + const bitstream = this.listenThumbnail.payload; + if (bitstream && bitstream.hasMetadata('dc.description')) { + this.customDescription = bitstream.firstMetadataValue('dc.description'); + } } } }