From 11974740093dd5bb75da843f2a8bb3752c5029cd Mon Sep 17 00:00:00 2001 From: Giuseppe Digilio Date: Wed, 22 Nov 2023 15:42:51 +0100 Subject: [PATCH 1/4] [DURACOM-208] Add a property to be able to provide description message --- .../browse-by-taxonomy-page.component.html | 4 ++- .../browse-by-taxonomy-page.component.ts | 19 +++++++++--- .../vocabulary-treeview-modal.component.html | 1 + ...ocabulary-treeview-modal.component.spec.ts | 11 ++++++- .../vocabulary-treeview-modal.component.ts | 30 +++++++++++++++++-- .../vocabulary-treeview.component.html | 4 +-- .../vocabulary-treeview.component.ts | 20 ++++++++++--- src/assets/i18n/en.json5 | 4 +++ 8 files changed, 78 insertions(+), 15 deletions(-) diff --git a/src/app/browse-by/browse-by-taxonomy-page/browse-by-taxonomy-page.component.html b/src/app/browse-by/browse-by-taxonomy-page/browse-by-taxonomy-page.component.html index 0ae3da6847b..b55415aa11e 100644 --- a/src/app/browse-by/browse-by-taxonomy-page/browse-by-taxonomy-page.component.html +++ b/src/app/browse-by/browse-by-taxonomy-page/browse-by-taxonomy-page.component.html @@ -1,7 +1,9 @@
- diff --git a/src/app/browse-by/browse-by-taxonomy-page/browse-by-taxonomy-page.component.ts b/src/app/browse-by/browse-by-taxonomy-page/browse-by-taxonomy-page.component.ts index cf6345bf394..946808c3ca5 100644 --- a/src/app/browse-by/browse-by-taxonomy-page/browse-by-taxonomy-page.component.ts +++ b/src/app/browse-by/browse-by-taxonomy-page/browse-by-taxonomy-page.component.ts @@ -1,12 +1,15 @@ -import { Component, OnInit, Inject, OnDestroy } from '@angular/core'; -import { VocabularyOptions } from '../../core/submission/vocabularies/models/vocabulary-options.model'; -import { VocabularyEntryDetail } from '../../core/submission/vocabularies/models/vocabulary-entry-detail.model'; +import { Component, Inject, OnDestroy, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; + import { Observable, Subscription } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { TranslateService } from '@ngx-translate/core'; + +import { VocabularyOptions } from '../../core/submission/vocabularies/models/vocabulary-options.model'; +import { VocabularyEntryDetail } from '../../core/submission/vocabularies/models/vocabulary-entry-detail.model'; import { BrowseDefinition } from '../../core/shared/browse-definition.model'; import { GenericConstructor } from '../../core/shared/generic-constructor'; import { BROWSE_BY_COMPONENT_FACTORY } from '../browse-by-switcher/browse-by-decorator'; -import { map } from 'rxjs/operators'; import { ThemeService } from 'src/app/shared/theme-support/theme.service'; import { HierarchicalBrowseDefinition } from '../../core/shared/hierarchical-browse-definition.model'; @@ -60,8 +63,14 @@ export class BrowseByTaxonomyPageComponent implements OnInit, OnDestroy { */ browseByComponentSubs: Subscription[] = []; + /** + * Browse description + */ + description: string; + public constructor( protected route: ActivatedRoute, protected themeService: ThemeService, + protected translate: TranslateService, @Inject(BROWSE_BY_COMPONENT_FACTORY) private getComponentByBrowseByType: (browseByType, theme) => GenericConstructor) { } @@ -73,9 +82,11 @@ export class BrowseByTaxonomyPageComponent implements OnInit, OnDestroy { }) ); this.browseByComponentSubs.push(this.browseByComponent.subscribe((browseDefinition: HierarchicalBrowseDefinition) => { + this.selectedItems = []; this.facetType = browseDefinition.facetType; this.vocabularyName = browseDefinition.vocabulary; this.vocabularyOptions = { name: this.vocabularyName, closed: true }; + this.description = this.translate.instant(`browse.metadata.${this.vocabularyName}.tree.descrption`); })); } diff --git a/src/app/shared/form/vocabulary-treeview-modal/vocabulary-treeview-modal.component.html b/src/app/shared/form/vocabulary-treeview-modal/vocabulary-treeview-modal.component.html index 71eb8e14765..8498411a38c 100644 --- a/src/app/shared/form/vocabulary-treeview-modal/vocabulary-treeview-modal.component.html +++ b/src/app/shared/form/vocabulary-treeview-modal/vocabulary-treeview-modal.component.html @@ -7,6 +7,7 @@