feat: Minor fixes (#73)
* feat: Address JPs Feedback * fix: settings config * fix: fix tests
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(helmet())
|
||||
app.use(bodyParser.json())
|
||||
app.use(bodyParser.urlencoded({ extended: false }))
|
||||
app.use(bodyParser.urlencoded({ extended: true }))
|
||||
app.use(cookieParser())
|
||||
app.use(express.static(path.join(__dirname, 'public')))
|
||||
|
||||
|
||||
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)) {
|
||||
landingPage = await attachEntryState(landingPage)
|
||||
}
|
||||
|
||||
console.log(landingPage.fields.contentModules[0].fields.course.fields.image)
|
||||
response.render('landingPage', { title: pathname, landingPage })
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ module.exports.getSettings = async (request, response, next) => {
|
||||
module.exports.postSettings = async (request, response, next) => {
|
||||
const currentLocale = response.locals.currentLocale
|
||||
let errorList = []
|
||||
const { spaceId, deliveryToken, previewToken, editorialFeatures } = request.body
|
||||
const { spaceId, deliveryToken, previewToken, editorialFeatures, qs } = request.body
|
||||
const settings = {
|
||||
spaceId,
|
||||
deliveryToken,
|
||||
@@ -165,11 +165,11 @@ module.exports.postSettings = async (request, response, next) => {
|
||||
]
|
||||
}
|
||||
}, {})
|
||||
|
||||
await renderSettings(response, {
|
||||
settings,
|
||||
errors,
|
||||
hasErrors: errorList.length > 0,
|
||||
success: errorList.length === 0
|
||||
success: errorList.length === 0,
|
||||
queryString: qs
|
||||
})
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ describe('The Example App', () => {
|
||||
context('Home', () => {
|
||||
it('renders home page', () => {
|
||||
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')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ html
|
||||
| .
|
||||
p
|
||||
| #{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
|
||||
a(href='#').modal__cta.close #{translate('modalCTALabel', currentLocale.code)}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
include ./_courseCard
|
||||
|
||||
mixin moduleHighlightedCourse(module, course)
|
||||
.module.module-higlighted-course
|
||||
.module-higlighted-course__wrapper(style=`background-image: url(${course.fields.image.fields.file.url});`)
|
||||
.module-higlighted-course__overlay
|
||||
.module-higlighted-course__content
|
||||
.module.module-highlighted-course
|
||||
.module-highlighted-course__wrapper(style=`background-image: url(${course.fields.image.fields.file.url});`)
|
||||
.module-highlighted-course__overlay
|
||||
.module-highlighted-course__content
|
||||
if(course.fields.categories)
|
||||
.module-higlighted-course__categories
|
||||
.module-highlighted-course__categories
|
||||
each category in course.fields.categories
|
||||
a.module-higlighted-course__category(href=`/courses/categories/${category.fields.slug}${queryString}`) #{category.fields.title}
|
||||
h2.module-higlighted-course__title
|
||||
a.module-highlighted-course__category(href=`/courses/categories/${category.fields.slug}${queryString}`) #{category.fields.title}
|
||||
h2.module-highlighted-course__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)}
|
||||
.module-higlighted-course__link-wrapper
|
||||
a.module-higlighted-course__link(href=`/courses/${course.fields.slug}${queryString}`) #{translate('viewCourseLabel', currentLocale.code)}
|
||||
.module-highlighted-course__link-wrapper
|
||||
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-item
|
||||
input(type="hidden" name="qs" value=queryString)
|
||||
label(for="input-space-id") #{translate('spaceIdLabel', currentLocale.code)}
|
||||
input(type="text" name="spaceId" id="input-space-id" value=settings.spaceId)
|
||||
if 'spaceId' in errors
|
||||
|
||||
Reference in New Issue
Block a user