feat: Minor fixes (#73)

* feat: Address JPs Feedback

* fix: settings config

* fix: fix tests
This commit is contained in:
Khaled Garbaya
2017-11-30 12:46:30 +01:00
committed by GitHub
parent ffc2df6a41
commit b456500c9f
9 changed files with 20 additions and 19 deletions

2
app.js
View File

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

View File

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

View File

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

View File

@@ -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')
})
})

View File

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

View File

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

View File

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