Commit 33babcf8 authored by Yannis Barlas's avatar Yannis Barlas

feat(submission form): allow free text in initial form text fields

parent f3b1eadd
......@@ -33,6 +33,7 @@ module.exports = {
'config',
'*',
],
skipQuestions: ['body', 'breaking', 'footer'],
types: choices,
}
......
......@@ -47,14 +47,12 @@ const initial = {
.string()
.required('Email is required')
.email('Invalid email adress'),
name: yup
.string()
.required('Name is required')
.test(
'is author valid',
'Must be a registered WormBase Person',
validateWBExists,
),
name: yup.string().required('Name is required'),
// .test(
// 'is author valid',
// 'Must be a registered WormBase Person',
// validateWBExists,
// ),
WBId: yup.string(),
}),
coAuthors: yup.array(
......@@ -90,32 +88,30 @@ const initial = {
},
)
.nullable(),
name: yup
.string()
.test(
'co-author pass if all fields empty',
'Name is required for all authors',
// eslint-disable-next-line func-names, prefer-arrow-callback
function(val) {
if (val) return true
name: yup.string().test(
'co-author pass if all fields empty',
'Name is required for all authors',
// eslint-disable-next-line func-names, prefer-arrow-callback
function(val) {
if (val) return true
const { affiliations, credit } = this.parent
const { affiliations, credit } = this.parent
if (
(!affiliations || affiliations.length === 0) &&
isCreditEmpty(credit)
) {
return true
}
if (
(!affiliations || affiliations.length === 0) &&
isCreditEmpty(credit)
) {
return true
}
return false
},
)
.test(
'is co-author valid',
'Must be a registered WormBase Person',
validateWBExists,
),
return false
},
),
// .test(
// 'is co-author valid',
// 'Must be a registered WormBase Person',
// validateWBExists,
// )
}),
),
comments: yup.string(),
......@@ -132,14 +128,12 @@ const initial = {
val => stripHTML(val).length > 0,
),
laboratory: yup.object().shape({
name: yup
.string()
.required('Laboratory is required')
.test(
'is-lab-valid',
'Must a registered WormBase Laboratory',
validateWBExists,
),
name: yup.string().required('Laboratory is required'),
// .test(
// 'is-lab-valid',
// 'Must a registered WormBase Laboratory',
// validateWBExists,
// )
WBId: yup.string(),
}),
methods: yup
......@@ -164,13 +158,12 @@ const initial = {
val => stripHTML(val).length > 0,
),
suggestedReviewer: yup.object().shape({
name: yup
.string()
.test(
'is suggested reviewer valid',
'Must be a registered WormBase Person',
validateWBExists,
),
name: yup.string(),
// .test(
// 'is suggested reviewer valid',
// 'Must be a registered WormBase Person',
// validateWBExists,
// )
}),
title: yup
.string()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment