fix: Fix New fields naming

This commit is contained in:
Khaled Garbaya
2017-10-17 11:59:09 +02:00
committed by Benedikt Rötsch
parent 418871c6cf
commit c6d12b4afd
9 changed files with 19 additions and 15 deletions

1
app.js
View File

@@ -106,7 +106,6 @@ app.use(function (req, res, next) {
// error handler // error handler
app.use(function (err, req, res, next) { app.use(function (err, req, res, next) {
// set locals, only providing error in development // set locals, only providing error in development
res.locals.message = err.message
res.locals.error = req.app.get('env') === 'development' ? err : {} res.locals.error = req.app.get('env') === 'development' ? err : {}
// render the error page // render the error page

View File

@@ -8,7 +8,6 @@
exports.catchErrors = (fn) => { exports.catchErrors = (fn) => {
return function (req, res, next) { return function (req, res, next) {
return fn(req, res, next).catch((e) => { return fn(req, res, next).catch((e) => {
console.log(e)
next(e) next(e)
}) })
} }

View File

@@ -1,5 +1,4 @@
const marked = require('marked') const marked = require('marked')
// Parse markdown text // Parse markdown text
exports.markdown = (content) => { exports.markdown = (content) => {
content = content || '' content = content || ''

View File

@@ -22,6 +22,7 @@
"marked": "^0.3.6", "marked": "^0.3.6",
"morgan": "~1.7.0", "morgan": "~1.7.0",
"pug": "~2.0.0-beta6", "pug": "~2.0.0-beta6",
"safe-json-stringify": "^1.0.4",
"serve-favicon": "~2.3.0" "serve-favicon": "~2.3.0"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -48,12 +48,15 @@ exports.getCourses = assert((locale = 'en-US', api = `cda`) => {
exports.getLandingPage = (slug, locale = 'en-US', api = `cda`) => { exports.getLandingPage = (slug, locale = 'en-US', api = `cda`) => {
const client = api === 'cda' ? cdaClient : cpaClient const client = api === 'cda' ? cdaClient : cpaClient
return client.getEntries({ return client.getEntries({
content_type: 'landingPage', content_type: 'layout',
locale, locale,
'fields.slug': slug, 'fields.slug': slug,
include: 10 include: 10
}) })
.then((response) => response.items[0]) .then((response) => {
console.log(response.items[0])
return response.items[0]
})
} }
// the SDK supports link resolution only when you call the collection endpoints // the SDK supports link resolution only when you call the collection endpoints

View File

@@ -1,5 +1,5 @@
NODE_ENV=development NODE_ENV=development
CF_SPACE=7ug04s118u1d CF_SPACE=nr89mbmufcmp
CF_ACCESS_TOKEN=f3388cdce19c82685bfbd4a5e20e8bd2581580d7c6e6c6aa4890d8e2e480b930 CF_ACCESS_TOKEN=76055779832fdf2e228b0c658cc5b161873de870682e736a673c375a0d142a47
CF_PREVIEW_ACCESS_TOKEN=eb77b8bd61d16df53bcd6cfb2b9d1e405e10241b9017550174740e5442e08443 CF_PREVIEW_ACCESS_TOKEN=f3e64121a4a3d2e1794df93cbd285c5a60f1daadfe63d295bdccc4607bfb1d4
PORT=3000 PORT=3000

View File

@@ -14,7 +14,10 @@ block content
li Check if there's any content for this locale li Check if there's any content for this locale
li Verify credentials are correct and up to date li Verify credentials are correct and up to date
li Check the stack trace below li Check the stack trace below
if error.response
h2 Error
pre.error__stack-trace
code.shell #{helpers.dump(error.response.data)}
h2 Stack trace h2 Stack trace
pre.error__stack-trace pre.error__stack-trace
code.shell #{error.stack} code.shell #{error.stack}

View File

@@ -12,11 +12,11 @@ block content
+breadcrumb +breadcrumb
each module in landingPage.fields.contentModules each module in landingPage.fields.contentModules
case module.sys.contentType.sys.id case module.sys.contentType.sys.id
when 'landingPageModuleCopy' when 'layoutCopy'
+moduleCopy(module) +moduleCopy(module)
when 'landingPageModuleHeroImage' when 'layoutHeroImage'
+moduleHeroImage(module) +moduleHeroImage(module)
when 'landingPageModuleHighlightedCourse' when 'layoutHighlightedCourse'
+moduleHighlightedCourse(module, module.fields.course) +moduleHighlightedCourse(module, module.fields.course)

View File

@@ -11,12 +11,12 @@ mixin lesson(lesson, course, nextLesson)
each module in lesson.fields.modules each module in lesson.fields.modules
if module.sys.contentType if module.sys.contentType
case module.sys.contentType.sys.id case module.sys.contentType.sys.id
when 'lessonModuleCodeSnippets' when 'lessonCodeSnippets'
+lessonModuleCodeSnippet(module) +lessonModuleCodeSnippet(module)
when 'lessonModuleCopy' when 'lessonCopy'
+lessonModuleCopy(module) +lessonModuleCopy(module)
when 'lessonModuleImage' when 'lessonModuleImage'
+lessonModuleImage(module) +lessonImage(module)
else else
h2 ️️⚠️ Invalid lesson module h2 ️️⚠️ Invalid lesson module
p p