feat(controls): add help text to API dropdown

This commit is contained in:
Benedikt Rötsch
2017-11-08 15:28:45 +01:00
committed by Benedikt Rötsch
parent da942eda24
commit 229a892bfc
4 changed files with 36 additions and 26 deletions

30
app.js
View File

@@ -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