-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[R20-1312] Added new content type for topics and tags listing
- Loading branch information
Showing
16 changed files
with
215 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
packages/ripple-tide-topic/components/global/TideTopic.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<template> | ||
<TideSearchListingPage | ||
:site="site" | ||
:contentPage="page" | ||
:title="page.header.title" | ||
:searchListingConfig="searchListingConfig" | ||
:queryConfig="queryConfig" | ||
:globalFilters="globalFilters" | ||
:userFilters="[]" | ||
:resultsLayout="resultsLayout" | ||
:searchResultsMappingFn="searchResultsMappingFn" | ||
/> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { TideSiteData } from '@dpc-sdp/ripple-tide-api/types' | ||
import type { TideTopicPage } from '../../types' | ||
import { useRuntimeConfig } from '#imports' | ||
import type { MappedSearchResult } from '@dpc-sdp/ripple-tide-search/types' | ||
interface Props { | ||
site: TideSiteData | ||
page: TideTopicPage | ||
} | ||
const props = defineProps<Props>() | ||
const { public: config } = useRuntimeConfig() | ||
const siteId = config.tide?.site | ||
const searchListingConfig = { | ||
labels: { | ||
placeholder: `Search in '${props.page.filter.value}'` | ||
}, | ||
customSort: [ | ||
{ | ||
_score: 'desc' | ||
} | ||
] | ||
} | ||
const globalFilters = [ | ||
{ terms: { field_node_site: [siteId] } }, | ||
{ | ||
terms: { | ||
[props.page.filter.field]: [props.page.filter.value] | ||
} | ||
} | ||
] | ||
const resultsLayout = { | ||
component: 'TideSearchResultsList' | ||
} | ||
const queryConfig = { | ||
multi_match: { | ||
query: '{{query}}', | ||
fields: [ | ||
'title^3', | ||
'field_landing_page_summary^2', | ||
'body', | ||
'field_paragraph_body', | ||
'summary_processed' | ||
] | ||
} | ||
} | ||
const searchResultsMappingFn = (item): MappedSearchResult<any> => { | ||
return { | ||
id: item._id, | ||
component: 'TideSearchResult', | ||
props: { | ||
result: item._source | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { IRplTideModuleMapping } from '@dpc-sdp/ripple-tide-api/types' | ||
import { | ||
tidePageBaseMapping, | ||
tidePageBaseIncludes | ||
} from '@dpc-sdp/nuxt-ripple/mapping' | ||
|
||
const tideTopicModule: IRplTideModuleMapping = { | ||
mapping: { | ||
...tidePageBaseMapping(), | ||
type: () => 'topic', | ||
title: (field) => | ||
`${field.type === 'taxonomy_term--tags' ? 'Tags' : 'Topic'} - ${ | ||
field.name | ||
}`, | ||
header: { | ||
title: 'name' | ||
}, | ||
filter: { | ||
field: (field) => { | ||
return field.type === 'taxonomy_term--tags' | ||
? 'field_tags_name' | ||
: 'field_topic_name' | ||
}, | ||
value: 'name' | ||
} | ||
}, | ||
includes: [...tidePageBaseIncludes()] | ||
} | ||
|
||
export default tideTopicModule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default defineNuxtConfig({}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"license": "Apache-2.0", | ||
"name": "@dpc-sdp/ripple-tide-topic", | ||
"description": "Ripple mappings and components for Tide topics and tags", | ||
"main": "./nuxt.config.ts", | ||
"exports": { | ||
".": "./nuxt.config.ts", | ||
"./mapping": "./mapping/index.ts", | ||
"./types": "./types.ts" | ||
}, | ||
"version": "2.1.0-alpha.188", | ||
"dependencies": { | ||
"@dpc-sdp/nuxt-ripple": "workspace:*", | ||
"@dpc-sdp/ripple-tide-api": "workspace:*", | ||
"@dpc-sdp/ripple-ui-core": "workspace:*", | ||
"@dpc-sdp/ripple-tide-search": "workspace:*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineNitroPlugin } from 'nitropack/dist/runtime/plugin' | ||
import topicMapping from './../../mapping' | ||
import type { NitroApp } from 'nitropack' | ||
|
||
export default defineNitroPlugin(async (nitroApp: NitroApp) => { | ||
nitroApp.tide?.pageApi.setContentType('topic', topicMapping) | ||
nitroApp.tide?.pageApi.setContentType('tags', topicMapping) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { TidePageBase } from '@dpc-sdp/ripple-tide-api/types' | ||
|
||
export interface TideTopicPage extends TidePageBase { | ||
/** | ||
* @description RplHeader component | ||
*/ | ||
header: { | ||
title: string | ||
} | ||
/** | ||
* @description Props for component wrapper | ||
*/ | ||
filter: { | ||
field: string | ||
value: string | ||
} | ||
} |
Oops, something went wrong.