Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
X
xpub-faraday
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
xpub
xpub-faraday
Commits
0929687b
Commit
0929687b
authored
7 years ago
by
Alf Eaton
Browse files
Options
Downloads
Patches
Plain Diff
Use form.registeredFields
parent
6c38ba61
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/component-submit/src/components/Validots.js
+18
-35
18 additions, 35 deletions
packages/component-submit/src/components/Validots.js
with
18 additions
and
35 deletions
packages/component-submit/src/components/Validots.js
+
18
−
35
View file @
0929687b
import
React
from
'
react
'
import
React
from
'
react
'
import
{
Field
,
FormSection
}
from
'
redux-form
'
import
{
Field
}
from
'
redux-form
'
import
{
map
}
from
'
lodash
'
import
Validot
from
'
./Validot
'
import
Validot
from
'
./Validot
'
import
{
connect
}
from
'
react-redux
'
// TODO: build sections and fields from configuration
// TODO: build sections and fields from configuration
// TODO: is the order of map(form.registeredFields) guaranteed to be the same?
// TODO: use journal config instead of form.registeredFields once using it to build the form
const
Validots
=
({
journal
,
valid
,
handleSubmit
})
=>
(
const
Validots
=
({
form
,
journal
,
valid
,
handleSubmit
})
=>
(
<
div
>
<
div
>
<
FormSection
name
=
"
metadata
"
>
{
form
.
registeredFields
&&
(
<
Field
name
=
"
title
"
component
=
{
Validot
}
/
>
map
(
form
.
registeredFields
,
field
=>
(
<
Field
name
=
"
abstract
"
component
=
{
Validot
}
/
>
<
div
>
<
Field
name
=
"
authors
"
component
=
{
Validot
}
/
>
<
Field
name
=
{
field
.
name
}
component
=
{
Validot
}
/
>
<
Field
name
=
"
keywords
"
component
=
{
Validot
}
/
>
<
/div
>
<
/FormSection
>
))
)}
<
FormSection
name
=
"
declarations
"
>
{
journal
.
declarations
.
questions
.
map
(
question
=>
(
<
Field
name
=
{
question
.
id
}
component
=
{
Validot
}
/
>
))}
<
/FormSection
>
<
FormSection
name
=
"
suggestions
"
>
<
FormSection
name
=
"
reviewers
"
>
<
Field
name
=
"
suggested
"
component
=
{
Validot
}
/
>
<
Field
name
=
"
opposed
"
component
=
{
Validot
}
/
>
<
/FormSection
>
<
FormSection
name
=
"
editors
"
>
<
Field
name
=
"
suggested
"
component
=
{
Validot
}
/
>
<
Field
name
=
"
opposed
"
component
=
{
Validot
}
/
>
<
/FormSection
>
<
/FormSection
>
<
FormSection
name
=
"
notes
"
>
<
Field
name
=
"
fundingAcknowledgement
"
component
=
{
Validot
}
/
>
<
Field
name
=
"
specialInstructions
"
component
=
{
Validot
}
/
>
<
/FormSection
>
<
FormSection
name
=
"
files
"
>
<
Field
name
=
"
supplementary
"
component
=
{
Validot
}
/
>
<
/FormSection
>
<
button
<
button
onClick
=
{
handleSubmit
}
onClick
=
{
handleSubmit
}
...
@@ -45,4 +24,8 @@ const Validots = ({ journal, valid, handleSubmit }) => (
...
@@ -45,4 +24,8 @@ const Validots = ({ journal, valid, handleSubmit }) => (
<
/div
>
<
/div
>
)
)
export
default
Validots
export
default
connect
(
state
=>
({
form
:
state
.
form
.
submit
})
)(
Validots
)
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment