Skip to content

Commit f15e926

Browse files
authored
Merge pull request #262 from performant-software/RB-fixing-result-field-filtering
Fixing some issues with `result_filtering` application
2 parents 3615046 + 053f587 commit f15e926

File tree

11 files changed

+13
-12
lines changed

11 files changed

+13
-12
lines changed

docs/search-detail-filtering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Search detail filtering
22

3-
You can filter what is shown in the detail pane when clicking an item in the search view. This is accomplished by adding a result_filtering object to the search block in the config.json file in the content directory.
3+
You can filter what is shown in the detail pane when clicking an item in the search view. This is accomplished by adding a result_filtering object in the config.json file in the content directory.
44

55
- To filter native fields add the name of the native field to the exclude array:
66

docs/upgrade-notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ TINA_PUBLIC_AUTH_USE_KEYCLOAK=true
122122
}
123123
```
124124

125-
- `search.results_filtering` - an object specifying fields to exclude on the detail panel for different model types, e.g.
125+
- `search.result_filtering` - an object specifying fields to exclude on the detail panel for different model types, e.g.
126126

127127
```
128128
"result_filtering": {

src/apps/pages/RecordDetail/UserDefined.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
import { getTranslations } from "@backend/i18n";
33
import UserDefinedFieldView from "@components/UserDefinedFieldView";
44
5-
const { record } = Astro.props
5+
const { record, excludes } = Astro.props
66
77
const lang = Astro.currentLocale;
88
const { t } = await getTranslations(lang);
99
---
1010
{record.user_defined && (
1111
<>
1212
{Object.keys(record.user_defined).map(uuid => (
13-
<div class="py-6">
13+
!excludes.includes(uuid) && <div class="py-6">
1414
<h2 class="capitalize text-lg font-semibold">{t(uuid)}</h2>
1515
<div class="text-neutral-800 break-words">
1616
<UserDefinedFieldView

src/apps/pages/RecordDetail/index.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ for (const modelType of Object.keys(record.relatedRecords)) {
8383
<slot />
8484
<UserDefined
8585
record={record}
86+
excludes={excludes}
8687
/>
8788
{relations.manifests && (
8889
<MediaContents

src/pages/[lang]/events/[uuid]/index.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const { t } = await getTranslations(Astro.currentLocale);
1313
const { lang, uuid } = Astro.params;
1414
1515
const { event } = await EventsService.getFull(uuid);
16-
const excludes = config.search?.result_filtering?.events?.exclude || [];
16+
const excludes = config.result_filtering?.events?.exclude || [];
1717
1818
const coverUrl = getCoverImage(event);
1919
const geometry = getRelatedGeometry(event);
@@ -35,7 +35,7 @@ export const getStaticPaths = async () => await getDetailPagePaths(config, Model
3535
if (event[field] && !excludes.includes(field)) {
3636
return (
3737
<div class="py-6">
38-
<h2 class="capitalize text-lg font-semibold">{t('start_date')}</h2>
38+
<h2 class="capitalize text-lg font-semibold">{t(field)}</h2>
3939
<div class="text-neutral-800">
4040
<p>{FuzzyDateUtils.getDateView(event[field])}</p>
4141
</div>

src/pages/[lang]/instances/[uuid]/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const { t } = await getTranslations(Astro.currentLocale);
1212
const { lang, uuid } = Astro.params;
1313
1414
const { instance } = await InstancesService.getFull(uuid);
15-
const excludes = config.search?.result_filtering?.instances?.exclude || [];
15+
const excludes = config.result_filtering?.instances?.exclude || [];
1616
1717
const coverUrl = getCoverImage(instance);
1818
const geometry = getRelatedGeometry(instance);

src/pages/[lang]/items/[uuid]/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const { t } = await getTranslations(Astro.currentLocale);
1212
const { lang, uuid } = Astro.params;
1313
1414
const { item } = await ItemsService.getFull(uuid);
15-
const excludes = config.search?.result_filtering?.items?.exclude || [];
15+
const excludes = config.result_filtering?.items?.exclude || [];
1616
1717
const coverUrl = getCoverImage(item);
1818
const geometry = getRelatedGeometry(item);

src/pages/[lang]/organizations/[uuid]/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const { t } = await getTranslations(Astro.currentLocale);
1212
const { lang, uuid } = Astro.params;
1313
1414
const { organization } = await OrganizationsService.getFull(uuid);
15-
const excludes = config.search?.result_filtering?.organizations?.exclude || [];
15+
const excludes = config.result_filtering?.organizations?.exclude || [];
1616
1717
const coverUrl = getCoverImage(organization);
1818
const geometry = getRelatedGeometry(organization);

src/pages/[lang]/people/[uuid]/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const { t } = await getTranslations(Astro.currentLocale);
1313
const { lang, uuid } = Astro.params;
1414
1515
const { person } = await PeopleService.getFull(uuid);
16-
const excludes = config.search?.result_filtering?.people?.exclude || [];
16+
const excludes = config.result_filtering?.people?.exclude || [];
1717
1818
const coverUrl = getCoverImage(person);
1919
const geometry = getRelatedGeometry(person);

src/pages/[lang]/places/[uuid]/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const { t } = await getTranslations(Astro.currentLocale);
1212
const { lang, uuid } = Astro.params;
1313
1414
const { place } = await PlacesService.getFull(uuid);
15-
const excludes = config.search?.result_filtering?.places?.exclude || [];
15+
const excludes = config.result_filtering?.places?.exclude || [];
1616
1717
const coverUrl = getCoverImage(place);
1818
const geometry = place?.place_geometry?.geometry_json

0 commit comments

Comments
 (0)