discover-page Class
Discover-page component. Builds a search interface utilizing SHARE. See retraction-watch, registries, and preprints discover pages for working examples.
Majority adapted from Ember-SHARE https://github.com/CenterForOpenScience/ember-share, with additions from PREPRINTS and REGISTRIES discover pages. Original Ember-SHARE facets and PREPRINTS/REGISTRIES facets behave differently at this time. You can build a discover-page that uses Ember-SHARE type facets -OR- PREPRINTS/REGISTRIES type facets. Would not recommend mixing until code is combined.
How to Use: Pass in custom text like searchPlaceholder. The facets property will enable you to customize the filters on the left-hand side of the discover page. Sort options are the sort dropdown options. Each query parameter must be passed in individually, so they are reflected in the URL. Logo and custom colors must be placed in the consuming application's stylesheet. Individual components can additionally be overridden in your application.
Sample usage:
{{discover-page
consumingService=consumingService
searchPlaceholder=searchPlaceholder
detailRoute=detailRoute
discoverHeader=discoverHeader
themeProvider=themeProvider
sortOptions=sortOptions
filterReplace=filterReplace
whiteListedProviders=whiteListedProviders
fetchedProviders=externalProviders
facets=facets
results=results
numberOfResults=numberOfResults
aggregations=aggregations
queryParamsState=queryParamsState
showActiveFilters=showActiveFilters
loading=fetchData.isRunning
clearFilters=(action 'clearFilters')
search=(action 'search')
size=size
page=page
q=q
sort=sort
}}
{{!-- plus any query params (e.g. provider=provider) --}}
Item Index
Methods
Methods
buildLockedQueryBody
-
lockedParams
For services where portion of query is restricted. Builds the locked portion of the query. For example, in preprints, types=['preprint', 'thesis'] is something that cannot be modified by the user.
Parameters:
-
lockedParams
Object- Locked param keys matched to the locked value.
Returns:
queryBody - locked portion of query body
buildQueryBody
-
queryParams
-
filters
-
queryParamsChanged
Construct queryBody for OSF facets
Parameters:
Returns:
queryBody - Stringified queryBody
constructBasicFilters
-
filterMap
-
filters
-
isProvider
-
queryParams
Construct filters for OSF facets (e.g., providers, subjects, etc.)
Parameters:
Returns:
filters - Filters for query body
sortContributors
-
contributors
Sort contributors by order cited and set bibliographic property
Parameters:
-
contributors
List- list.contributors from a SHARE ES result
Returns:
Properties
detailRoute
String
Name of detail route for consuming application, like "content" or "detail". Override if search result title should link to detail route.
fetchedProviders
Object
For PREPRINTS ONLY. Pass in the providers fetched in preprints app so they can be used in the provider carousel
filterReplace
Object
For PREPRINTS and REGISTRIES. A mapping of filter names for front-end display. Ex. {OSF: 'OSF Preprints'}.
page
Integer
Page query parameter. If "page" is one of your query params, it must be passed to the component so it can be updated.
Default: 1
Preprint provider loaded from theme service. Should be passed from consuming service so it is loaded before SHARE is queried.
Object
themeProvider
Default: ''
q
String
q query parameter. If "q" is one of your query params, it must be passed to the component so it can be updated.
Default: ''
showActiveFilters
Boolean
For PREPRINTS and REGISTRIES. Displays activeFilters box above search facets.
size
Integer
Size query parameter. If "size" is one of your query params, it must be passed to the component so it can be updated.
Default: 10
sort
String
Sort query parameter. If "sort" is one of your query params, it must be passed to the component so it can be updated.
Default: ''
sortOptions
Array
Sort dropdown options - Array of dictionaries. Each dictionary should have display and sortBy keys.
Default: [{ display: 'Relevance', sortBy: '' }]