diff --git a/app/models/related-property-path.ts b/app/models/related-property-path.ts index 1c73cb83686..3ab160edb39 100644 --- a/app/models/related-property-path.ts +++ b/app/models/related-property-path.ts @@ -11,6 +11,9 @@ interface PropertyPath { resourceType: Array<{ '@id': string }>; displayLabel: LanguageText[]; shortFormLabel: LanguageText[]; + description?: LanguageText[]; + link_text?: LanguageText[]; + link?: LanguageText[]; } export enum SuggestedFilterOperators { diff --git a/lib/osf-components/addon/components/search-page/filter-facet/component.ts b/lib/osf-components/addon/components/search-page/filter-facet/component.ts index 05cab02c036..e09b3d1a8f6 100644 --- a/lib/osf-components/addon/components/search-page/filter-facet/component.ts +++ b/lib/osf-components/addon/components/search-page/filter-facet/component.ts @@ -47,6 +47,10 @@ export default class FilterFacet extends Component { @tracked filterString = ''; @tracked hasMoreValueOptions = false; @tracked nextPageCursor = ''; + @tracked hasDescription = false; + @tracked description = ''; + @tracked link_text = ''; + @tracked link = ''; get shouldShowTopValues() { const { args: { property: { propertyPathKey } } } = this; @@ -56,6 +60,13 @@ export default class FilterFacet extends Component { @action toggleFacet() { if (this.shouldShowTopValues) { + const propertyPath = this.args.property.propertyPath || []; + this.hasDescription = propertyPath.length > 0 && + Array.isArray(propertyPath[0]?.description) && + propertyPath[0].description.length > 0; + this.description = propertyPath[0]?.description?.[0]?.['@value'] || ''; + this.link_text = propertyPath[0]?.link_text?.[0]?.['@value'] || ''; + this.link = propertyPath[0]?.link?.[0]?.['@value'] || ''; if (this.filterableValues.length === 0 && !taskFor(this.fetchFacetValues).lastComplete) { taskFor(this.fetchFacetValues).perform(); } diff --git a/lib/osf-components/addon/components/search-page/filter-facet/template.hbs b/lib/osf-components/addon/components/search-page/filter-facet/template.hbs index b146fa39a99..d2bd19de7e0 100644 --- a/lib/osf-components/addon/components/search-page/filter-facet/template.hbs +++ b/lib/osf-components/addon/components/search-page/filter-facet/template.hbs @@ -64,6 +64,16 @@ {{/if}} + {{#if (and this.hasDescription (not this.collapsed))}} + + {{/if}} {{/if}} - {{t 'search.filter-facet.see-more-modal-text'}} + {{#if (and this.hasDescription)}} + {{ this.description }} {{ this.link_text }} + {{else }} + {{t 'search.filter-facet.see-more-modal-text'}} + {{/if}}