Production build (#75)
* Production (#44) * test: Fix integration test * fix: Fix Editorial feature * chore(localization): move locales to i18n folder * feat(modules): add image caption and shadow * fix: clarify German translation🇩🇪 * chore(localization): fix typo (#47) * Split first paragraph into sections (#46) * feat(controls): add help text to API dropdown * fix(style): simplify header and fix mobile design * fix(style): simplify footer and fix mobile design * fix(style): update stylesheet and scripts file * test(e2e): adjust tests and make them fail on CI * language fixes * rename labels to use full api name * Refactor entry state toggle (#48) * chore(editorialFeatures): extract editorial features toggle * chore(refactor): rename function to make more contextual sense * Fix breadcrumb and add test for locales (#49) * test(unit): add test to check for locale consistency * fix(breadcrumb): translate lessons route * Change readme url to http from https (#52) * tests(e2e): expect only 2 courses * fix(cookies): fix variable naming and extend to two days maxAge * Change text on next lesson button (#54) * Retranslate advancedLabel * fix(translations): do not break on vim temp files. This is dedicated to JP * fix(analytics): use correct app-id * Add instructions to seed a space to readme (#61) * Change modal text; add link to model's repo to localization files (#57) * fix(links): link correct GH repository * fix(i18n): adjust view on github link label * fix(style): move GitHub link to the left * new screenshot * Update README.md (#63) * Update README.md * Update README.md * Https mistake and Heroku buton * fixup * fixup * feat(heroku): add app.json * docs(README): add linebreak * docs(README): minor adjustments * fix(tracking): add link click tracking to snowplow * Add translation for edit in the web app (#64) * chore(typo): fix error message (#67) * chore(update): remove image rendering on lessons (#65) * chore: Improve error page (#66) * chore: Improve error page * fix: Fix middlware order * fix: Remove console.log * fix: no more duplicate error messges (#71) * fix: Fix middlware order * fix: Remove console.log * feat: Uniq error meassages * fix: fix cli link (#72) * Add instructions to run app as Docker container (#68) * feat: Minor fixes (#73) * feat: Address JPs Feedback * fix: settings config * fix: fix tests * fix: fix error display * Fix Cookie Max Age (#74)
This commit is contained in:
2
app.js
2
app.js
@@ -27,7 +27,7 @@ app.set('view engine', 'pug')
|
|||||||
app.use(logger('dev'))
|
app.use(logger('dev'))
|
||||||
app.use(helmet())
|
app.use(helmet())
|
||||||
app.use(bodyParser.json())
|
app.use(bodyParser.json())
|
||||||
app.use(bodyParser.urlencoded({ extended: false }))
|
app.use(bodyParser.urlencoded({ extended: true }))
|
||||||
app.use(cookieParser())
|
app.use(cookieParser())
|
||||||
app.use(express.static(path.join(__dirname, 'public')))
|
app.use(express.static(path.join(__dirname, 'public')))
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const TWO_DAYS_IN_SECONDS = 172800 // 60 * 60 * 24 * 2
|
const TWO_DAYS_IN_MILLISECONDS = 172800000 // 1000 * 60 * 60 * 24 * 2
|
||||||
module.exports.updateCookie = (response, cookieName, value) => {
|
module.exports.updateCookie = (response, cookieName, value) => {
|
||||||
response.cookie(cookieName, value, { maxAge: TWO_DAYS_IN_SECONDS, httpOnly: true })
|
response.cookie(cookieName, value, { maxAge: TWO_DAYS_IN_MILLISECONDS, httpOnly: true })
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -31,6 +31,6 @@ module.exports.getLandingPage = async (request, response, next) => {
|
|||||||
if (shouldAttachEntryState(response)) {
|
if (shouldAttachEntryState(response)) {
|
||||||
landingPage = await attachEntryState(landingPage)
|
landingPage = await attachEntryState(landingPage)
|
||||||
}
|
}
|
||||||
|
console.log(landingPage.fields.contentModules[0].fields.course.fields.image)
|
||||||
response.render('landingPage', { title: pathname, landingPage })
|
response.render('landingPage', { title: pathname, landingPage })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ module.exports.getSettings = async (request, response, next) => {
|
|||||||
module.exports.postSettings = async (request, response, next) => {
|
module.exports.postSettings = async (request, response, next) => {
|
||||||
const currentLocale = response.locals.currentLocale
|
const currentLocale = response.locals.currentLocale
|
||||||
let errorList = []
|
let errorList = []
|
||||||
const { spaceId, deliveryToken, previewToken, editorialFeatures } = request.body
|
const { spaceId, deliveryToken, previewToken, editorialFeatures, qs } = request.body
|
||||||
const settings = {
|
const settings = {
|
||||||
spaceId,
|
spaceId,
|
||||||
deliveryToken,
|
deliveryToken,
|
||||||
@@ -165,11 +165,11 @@ module.exports.postSettings = async (request, response, next) => {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}, {})
|
}, {})
|
||||||
|
|
||||||
await renderSettings(response, {
|
await renderSettings(response, {
|
||||||
settings,
|
settings,
|
||||||
errors,
|
errors,
|
||||||
hasErrors: errorList.length > 0,
|
hasErrors: errorList.length > 0,
|
||||||
success: errorList.length === 0
|
success: errorList.length === 0,
|
||||||
|
queryString: qs
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ describe('The Example App', () => {
|
|||||||
context('Home', () => {
|
context('Home', () => {
|
||||||
it('renders home page', () => {
|
it('renders home page', () => {
|
||||||
cy.visit('/')
|
cy.visit('/')
|
||||||
cy.get('main .module-higlighted-course').should('have.length.gte', 1, 'should have at least one highlighted course')
|
cy.get('main .module-highlighted-course').should('have.length.gte', 1, 'should have at least one highlighted course')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ block content
|
|||||||
li #{translate('verifyCredentialsErrorLabel', currentLocale.code)}
|
li #{translate('verifyCredentialsErrorLabel', currentLocale.code)}
|
||||||
li #{translate('localeContentErrorLabel', currentLocale.code)}
|
li #{translate('localeContentErrorLabel', currentLocale.code)}
|
||||||
|
|
||||||
if error.stack
|
if error.stack
|
||||||
li #{translate('stackTraceErrorLabel', currentLocale.code)}
|
li #{translate('stackTraceErrorLabel', currentLocale.code)}
|
||||||
if error.response
|
if error.response
|
||||||
h2 #{translate('errorLabel', currentLocale.code)}
|
h2 #{translate('errorLabel', currentLocale.code)}
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ html
|
|||||||
| .
|
| .
|
||||||
p
|
p
|
||||||
| #{translate('modalSpaceIntro', currentLocale.code)}
|
| #{translate('modalSpaceIntro', currentLocale.code)}
|
||||||
a(href='https://github.com/contentful/content-models/tree/master/the-example-app' target='_blank' rel='noopener')=translate('modalSpaceLinkLabel', currentLocale.code)
|
a(href='https://github.com/contentful/content-models/blob/master/the-example-app/README.md ' target='_blank' rel='noopener')=translate('modalSpaceLinkLabel', currentLocale.code)
|
||||||
| .
|
| .
|
||||||
.modal__cta-wrapper
|
.modal__cta-wrapper
|
||||||
a(href='#').modal__cta.close #{translate('modalCTALabel', currentLocale.code)}
|
a(href='#').modal__cta.close #{translate('modalCTALabel', currentLocale.code)}
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
include ./_courseCard
|
include ./_courseCard
|
||||||
|
|
||||||
mixin moduleHighlightedCourse(module, course)
|
mixin moduleHighlightedCourse(module, course)
|
||||||
.module.module-higlighted-course
|
.module.module-highlighted-course
|
||||||
.module-higlighted-course__wrapper(style=`background-image: url(${course.fields.image.fields.file.url});`)
|
.module-highlighted-course__wrapper(style=`background-image: url(${course.fields.image.fields.file.url});`)
|
||||||
.module-higlighted-course__overlay
|
.module-highlighted-course__overlay
|
||||||
.module-higlighted-course__content
|
.module-highlighted-course__content
|
||||||
if(course.fields.categories)
|
if(course.fields.categories)
|
||||||
.module-higlighted-course__categories
|
.module-highlighted-course__categories
|
||||||
each category in course.fields.categories
|
each category in course.fields.categories
|
||||||
a.module-higlighted-course__category(href=`/courses/categories/${category.fields.slug}${queryString}`) #{category.fields.title}
|
a.module-highlighted-course__category(href=`/courses/categories/${category.fields.slug}${queryString}`) #{category.fields.title}
|
||||||
h2.module-higlighted-course__title
|
h2.module-highlighted-course__title
|
||||||
a(href=`/courses/${course.fields.slug}${queryString}`)= course.fields.title
|
a(href=`/courses/${course.fields.slug}${queryString}`)= course.fields.title
|
||||||
.module-higlighted-course__description-wrapper
|
.module-highlighted-course__description-wrapper
|
||||||
p !{helpers.markdown(course.fields.shortDescription)}
|
p !{helpers.markdown(course.fields.shortDescription)}
|
||||||
.module-higlighted-course__link-wrapper
|
.module-highlighted-course__link-wrapper
|
||||||
a.module-higlighted-course__link(href=`/courses/${course.fields.slug}${queryString}`) #{translate('viewCourseLabel', currentLocale.code)}
|
a.module-highlighted-course__link(href=`/courses/${course.fields.slug}${queryString}`) #{translate('viewCourseLabel', currentLocale.code)}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ block content
|
|||||||
|
|
||||||
form(action=`/settings` method="POST" class="form")
|
form(action=`/settings` method="POST" class="form")
|
||||||
.form-item
|
.form-item
|
||||||
|
input(type="hidden" name="qs" value=queryString)
|
||||||
label(for="input-space-id") #{translate('spaceIdLabel', currentLocale.code)}
|
label(for="input-space-id") #{translate('spaceIdLabel', currentLocale.code)}
|
||||||
input(type="text" name="spaceId" id="input-space-id" value=settings.spaceId)
|
input(type="text" name="spaceId" id="input-space-id" value=settings.spaceId)
|
||||||
if 'spaceId' in errors
|
if 'spaceId' in errors
|
||||||
|
|||||||
Reference in New Issue
Block a user