Skip to content

Commit

Permalink
Merge pull request #104 from akhuoa/feature/funding-program
Browse files Browse the repository at this point in the history
Add funding program in filters
  • Loading branch information
alan-wu authored Jan 15, 2025
2 parents 13f542b + 1df24c6 commit 06b0531
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
11 changes: 9 additions & 2 deletions src/algolia/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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',
}

Expand All @@ -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)

Expand Down
9 changes: 6 additions & 3 deletions src/components/SearchFilters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit 06b0531

Please sign in to comment.