From 1df24c61ab0b06a38db120cc6691c4ca1108504e Mon Sep 17 00:00:00 2001 From: akhuoa Date: Wed, 15 Jan 2025 13:43:22 +1300 Subject: [PATCH] Add funding program in filters --- src/algolia/utils.js | 11 +++++++++-- src/components/SearchFilters.vue | 9 ++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/algolia/utils.js b/src/algolia/utils.js index bd532c22..3fb1982d 100644 --- a/src/algolia/utils.js +++ b/src/algolia/utils.js @@ -40,6 +40,12 @@ export const facetPropPathMapping = [ facetPropPath: 'attributes.subject.ageCategory.value', facetSubpropPath: 'attributes.subject.ageCategory.subcategory.name' }, + { + label: 'Funding Program', + id: 'pennsieve.organization', + facetPropPath: 'pennsieve.organization.name', + facetSubpropPath: 'pennsieve.organization.subcategory.name' + }, ] // Same as above, but these show on the sidebar filters @@ -48,6 +54,7 @@ export const shownFilters = { 'organisms.primary.species.name' : 'Species', 'attributes.subject.sex.value' : 'Sex', 'attributes.subject.ageCategory.value' : 'Age Categories', + 'pennsieve.organization.name' : 'Funding Program', 'item.types.name' : 'Data type', } @@ -60,9 +67,9 @@ export function getFilters(selectedFacetArray=undefined) { return 'NOT item.published.status:embargo' } - // Switch the 'term' attribute to 'label' if 'label' does not exist + // Switch the 'term' attribute to 'label' if 'label' does not exist selectedFacetArray.forEach(f=>f.label=f.facet) - + let facets = removeShowAllFacets(selectedFacetArray) diff --git a/src/components/SearchFilters.vue b/src/components/SearchFilters.vue index 7f831165..2a092692 100644 --- a/src/components/SearchFilters.vue +++ b/src/components/SearchFilters.vue @@ -241,9 +241,12 @@ export default { // populate second level of options this.options[i].children.forEach((facetItem, j) => { - this.options[i].children[j].label = convertReadableLabel( - facetItem.label - ) + // Format labels except funding program + if (this.options[i].children[j].facetPropPath !== 'pennsieve.organization.name') { + this.options[i].children[j].label = convertReadableLabel( + facetItem.label + ) + } this.options[i].children[j].value = this.createCascaderItemValue(facet.label, facetItem.label) if (