feat(controls): add help text to API dropdown
This commit is contained in:
committed by
Benedikt Rötsch
parent
5be6c21628
commit
29f65020a5
30
app.js
30
app.js
@@ -44,21 +44,6 @@ app.use(settings)
|
||||
|
||||
// Make data available for our views to consume
|
||||
app.use(async function (request, response, next) {
|
||||
// Set active api based on query parameter
|
||||
const apis = [
|
||||
{
|
||||
id: 'cda',
|
||||
label: 'Delivery'
|
||||
},
|
||||
{
|
||||
id: 'cpa',
|
||||
label: 'Preview'
|
||||
}
|
||||
]
|
||||
|
||||
response.locals.currentApi = apis
|
||||
.find((api) => api.id === (request.query.api || 'cda'))
|
||||
|
||||
// Get enabled locales from Contentful
|
||||
const space = await getSpace()
|
||||
response.locals.locales = space.locales
|
||||
@@ -79,6 +64,21 @@ app.use(async function (request, response, next) {
|
||||
initializeTranslations()
|
||||
response.locals.translate = translate
|
||||
|
||||
// Set active api based on query parameter
|
||||
const apis = [
|
||||
{
|
||||
id: 'cda',
|
||||
label: translate('cdaApiLabel', response.locals.currentLocale.code)
|
||||
},
|
||||
{
|
||||
id: 'cpa',
|
||||
label: translate('cpaApiLabel', response.locals.currentLocale.code)
|
||||
}
|
||||
]
|
||||
|
||||
response.locals.currentApi = apis
|
||||
.find((api) => api.id === (request.query.api || 'cda'))
|
||||
|
||||
// Inject custom helpers
|
||||
response.locals.helpers = helpers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user