From 6a8e20c2b96fc40b656a830a5c3fc2491699dd13 Mon Sep 17 00:00:00 2001 From: Davide Negretti Date: Wed, 22 Nov 2023 11:17:22 +0100 Subject: [PATCH] [DSC-1352] Move breadcrumb char limit property inside layout configuration properties --- ...runcate-breadcrumb-item-characters.pipe.ts | 2 +- src/config/app-config.interface.ts | 1 - src/config/default-app-config.ts | 38 ++++++++++--------- src/config/layout-config.interfaces.ts | 5 +++ src/environments/environment.test.ts | 6 ++- 5 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/app/breadcrumbs/breadcrumb/truncate-breadcrumb-item-characters.pipe.ts b/src/app/breadcrumbs/breadcrumb/truncate-breadcrumb-item-characters.pipe.ts index edd6bcdb4d5..ebfade6f89f 100644 --- a/src/app/breadcrumbs/breadcrumb/truncate-breadcrumb-item-characters.pipe.ts +++ b/src/app/breadcrumbs/breadcrumb/truncate-breadcrumb-item-characters.pipe.ts @@ -10,7 +10,7 @@ export class TruncateBreadcrumbItemCharactersPipe implements PipeTransform { * The maximum number of characters to display in a breadcrumb item * @type {number} */ - readonly charLimit: number = environment.breadcrumbCharLimit; + readonly charLimit: number = environment.layout.breadcrumbs.charLimit; /** * Truncates the text based on the configured char number allowed per breadcrumb element. diff --git a/src/config/app-config.interface.ts b/src/config/app-config.interface.ts index 8d03ef86426..f95a82dd399 100644 --- a/src/config/app-config.interface.ts +++ b/src/config/app-config.interface.ts @@ -68,7 +68,6 @@ interface AppConfig extends Config { attachmentRendering: AttachmentRenderingConfig; advancedAttachmentRendering: AdvancedAttachmentRenderingConfig; searchResult: SearchResultConfig; - breadcrumbCharLimit: number; } /** diff --git a/src/config/default-app-config.ts b/src/config/default-app-config.ts index 2b4a24e1043..bb4f5740a74 100644 --- a/src/config/default-app-config.ts +++ b/src/config/default-app-config.ts @@ -511,23 +511,23 @@ export class DefaultAppConfig implements AppConfig { urn: [ { name: 'doi', - baseUrl: 'https://doi.org/' + baseUrl: 'https://doi.org/', }, { name: 'hdl', - baseUrl: 'https://hdl.handle.net/' + baseUrl: 'https://hdl.handle.net/', }, { name: 'scopus', - baseUrl: 'https://www.scopus.com/authid/detail.uri?authorId=' + baseUrl: 'https://www.scopus.com/authid/detail.uri?authorId=', }, { name: 'researcherid', - baseUrl: 'http://www.researcherid.com/rid/' + baseUrl: 'http://www.researcherid.com/rid/', }, { name: 'mailto', - baseUrl: 'mailto:' + baseUrl: 'mailto:', } ], crisRef: [ @@ -536,7 +536,7 @@ export class DefaultAppConfig implements AppConfig { entityStyle: { default: { icon: 'fa fa-info', - style: 'text-info' + style: 'text-info', } } }, @@ -545,7 +545,7 @@ export class DefaultAppConfig implements AppConfig { entityStyle: { default: { icon: 'fa fa-user', - style: 'text-info' + style: 'text-info', } } }, @@ -554,7 +554,7 @@ export class DefaultAppConfig implements AppConfig { entityStyle: { default: { icon: 'fa fa-university', - style: 'text-info' + style: 'text-info', } } }, @@ -563,7 +563,7 @@ export class DefaultAppConfig implements AppConfig { entityStyle: { default: { icon: 'fas fa-project-diagram', - style: 'text-info' + style: 'text-info', } } } @@ -573,18 +573,18 @@ export class DefaultAppConfig implements AppConfig { }, itemPage: { OrgUnit: { - orientation: 'vertical' + orientation: 'vertical', }, Project: { - orientation: 'vertical' + orientation: 'vertical', }, default: { - orientation: 'horizontal' + orientation: 'horizontal', }, }, metadataBox: { defaultMetadataLabelColStyle: 'col-3', - defaultMetadataValueColStyle: 'col-9' + defaultMetadataValueColStyle: 'col-9', }, collectionsBox: { defaultCollectionsLabelColStyle: 'col-3 font-weight-bold', @@ -597,6 +597,9 @@ export class DefaultAppConfig implements AppConfig { navbar: { // If true, show the "Community and Collections" link in the navbar; otherwise, show it in the admin sidebar showCommunityCollection: true, + }, + breadcrumbs: { + charLimit: 10, } }; @@ -605,17 +608,17 @@ export class DefaultAppConfig implements AppConfig { { value: 0, icon: 'fa fa-globe', - color: 'green' + color: 'green', }, { value: 1, icon: 'fa fa-key', - color: 'orange' + color: 'orange', }, { value: 2, icon: 'fa fa-lock', - color: 'red' + color: 'red', } ] }; @@ -730,7 +733,7 @@ export class DefaultAppConfig implements AppConfig { name: 'checksum', type: AdvancedAttachmentElementType.Attribute, } - ] + ], }; searchResult: SearchResultConfig = { @@ -738,5 +741,4 @@ export class DefaultAppConfig implements AppConfig { authorMetadata: ['dc.contributor.author', 'dc.creator', 'dc.contributor.*'], }; - breadcrumbCharLimit = 10; } diff --git a/src/config/layout-config.interfaces.ts b/src/config/layout-config.interfaces.ts index b5f293800c1..88e52ac54fd 100644 --- a/src/config/layout-config.interfaces.ts +++ b/src/config/layout-config.interfaces.ts @@ -38,6 +38,10 @@ export interface NavbarConfig extends Config { showCommunityCollection: boolean; } +export interface BreadcrumbsConfig extends Config { + charLimit: number; +} + export interface CrisItemPageConfig extends Config { [entity: string]: CrisLayoutTypeConfig; default: CrisLayoutTypeConfig; @@ -59,6 +63,7 @@ export interface CrisLayoutConfig extends Config { export interface LayoutConfig extends Config { navbar: NavbarConfig; + breadcrumbs: BreadcrumbsConfig; } export interface SuggestionConfig extends Config { diff --git a/src/environments/environment.test.ts b/src/environments/environment.test.ts index 6956db23dcb..ee4912c49a0 100644 --- a/src/environments/environment.test.ts +++ b/src/environments/environment.test.ts @@ -421,7 +421,10 @@ export const environment: BuildConfig = { navbar: { // If true, show the "Community and Collections" link in the navbar; otherwise, show it in the admin sidebar showCommunityCollection: true, - } + }, + breadcrumbs: { + charLimit: 10, + }, }, security: { levels: [ @@ -554,5 +557,4 @@ export const environment: BuildConfig = { authorMetadata: ['dc.contributor.author', 'dc.contributor.editor', 'dc.contributor.contributor', 'dc.creator'], }, - breadcrumbCharLimit: 10, };