From e3b304846d629d4813897ee3c586544237b7f7cf Mon Sep 17 00:00:00 2001 From: JUDIT GRESKOVITS Date: Thu, 9 Feb 2017 11:56:34 +0000 Subject: [PATCH 1/3] Ensure forms are connected in containers --- frontend/src/components/new-project/billing.js | 11 +---------- frontend/src/containers/new-project/billing.js | 13 ++++++++++++- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/new-project/billing.js b/frontend/src/components/new-project/billing.js index 458102a6..441fb76e 100644 --- a/frontend/src/components/new-project/billing.js +++ b/frontend/src/components/new-project/billing.js @@ -1,5 +1,4 @@ const React = require('react'); -const ReduxForm = require('redux-form'); const ReactIntl = require('react-intl'); const Styled = require('styled-components'); @@ -9,10 +8,6 @@ const fns = require('@ui/shared/functions'); const Button = require('@ui/components/button'); const Card = require('@ui/components/payment-card'); -const { - reduxForm -} = ReduxForm; - const { FormattedMessage } = ReactIntl; @@ -120,8 +115,4 @@ NewProjectBilling.propTypes = { onSubmit: React.PropTypes.func.isRequired }; -module.exports = reduxForm({ - form: 'create-project', - destroyOnUnmount: false, - forceUnregisterOnUnmount: true -})(NewProjectBilling); +module.exports = NewProjectBilling; diff --git a/frontend/src/containers/new-project/billing.js b/frontend/src/containers/new-project/billing.js index b5081816..59268f6c 100644 --- a/frontend/src/containers/new-project/billing.js +++ b/frontend/src/containers/new-project/billing.js @@ -1,15 +1,20 @@ const React = require('react'); const ReactRedux = require('react-redux'); +const ReduxForm = require('redux-form'); const selectors = require('@state/selectors'); const actions = require('@state/actions'); const PropTypes = require('@root/prop-types'); -const BillingForm = require('@components/new-project/billing'); +const NewProjectBilling = require('@components/new-project/billing'); const { connect } = ReactRedux; +const { + reduxForm +} = ReduxForm; + const { orgByIdSelector } = selectors; @@ -18,6 +23,12 @@ const { handleNewProject } = actions; +const BillingForm = reduxForm({ + form: 'create-project', + destroyOnUnmount: false, + forceUnregisterOnUnmount: true +})(NewProjectBilling); + const Billing = (props) => { const { From eb3701e7846db8fa6c2f5b89dffd6fdad641b796 Mon Sep 17 00:00:00 2001 From: JUDIT GRESKOVITS Date: Thu, 9 Feb 2017 12:09:43 +0000 Subject: [PATCH 2/3] Move form creation to containers for new project --- frontend/src/components/new-project/index.js | 9 ++------- frontend/src/components/new-project/new-billing.js | 10 ++-------- frontend/src/containers/new-project/billing.js | 4 ++-- frontend/src/containers/new-project/new-billing.js | 11 ++++++++++- frontend/src/containers/new-project/new-project.js | 14 +++++++++++++- 5 files changed, 29 insertions(+), 19 deletions(-) diff --git a/frontend/src/components/new-project/index.js b/frontend/src/components/new-project/index.js index 7228b249..19a5a3d2 100644 --- a/frontend/src/components/new-project/index.js +++ b/frontend/src/components/new-project/index.js @@ -10,8 +10,7 @@ const Input = require('@ui/components/input'); const Button = require('@ui/components/button'); const { - Field, - reduxForm + Field } = ReduxForm; const { @@ -115,8 +114,4 @@ CreateProject.propTypes = { submitting: React.PropTypes.bool.isRequired }; -module.exports = reduxForm({ - form: 'create-project', - destroyOnUnmount: false, - forceUnregisterOnUnmount: true -})(CreateProject); +module.exports = CreateProject; diff --git a/frontend/src/components/new-project/new-billing.js b/frontend/src/components/new-project/new-billing.js index 5958ba06..2b37359a 100644 --- a/frontend/src/components/new-project/new-billing.js +++ b/frontend/src/components/new-project/new-billing.js @@ -10,8 +10,7 @@ const Input = require('@ui/components/input'); const Button = require('@ui/components/button'); const { - Field, - reduxForm + Field } = ReduxForm; const { @@ -146,9 +145,4 @@ CreateBilling.propTypes = { submitting: React.PropTypes.bool.isRequired }; -module.exports = reduxForm({ - form: 'create-project', - /*destroyOnUnmount: false, - forceUnregisterOnUnmount: true/*, - validate*/ -})(CreateBilling); +module.exports = CreateBilling; diff --git a/frontend/src/containers/new-project/billing.js b/frontend/src/containers/new-project/billing.js index 59268f6c..630edc42 100644 --- a/frontend/src/containers/new-project/billing.js +++ b/frontend/src/containers/new-project/billing.js @@ -23,7 +23,7 @@ const { handleNewProject } = actions; -const BillingForm = reduxForm({ +const NewProjectBillingForm = reduxForm({ form: 'create-project', destroyOnUnmount: false, forceUnregisterOnUnmount: true @@ -52,7 +52,7 @@ const Billing = (props) => { router.push(`/${org.id}/new-project/new-billing`); return ( - { const { diff --git a/frontend/src/containers/new-project/new-project.js b/frontend/src/containers/new-project/new-project.js index 89574e90..ebf86b38 100644 --- a/frontend/src/containers/new-project/new-project.js +++ b/frontend/src/containers/new-project/new-project.js @@ -1,18 +1,30 @@ const React = require('react'); const ReactRedux = require('react-redux'); +const ReduxForm = require('redux-form'); +const selectors = require('@state/selectors'); const selectors = require('@state/selectors'); const PropTypes = require('@root/prop-types'); -const NewProjectForm = require('@components/new-project'); +const CreateProject = require('@components/new-project'); const { connect } = ReactRedux; +const { + reduxForm +} = ReduxForm; + const { orgByIdSelector } = selectors; +const NewProjectForm = reduxForm({ + form: 'create-project', + destroyOnUnmount: false, + forceUnregisterOnUnmount: true +})(CreateProject); + const NewProject = (props) => { const { From bcc29ed1011de5f00ea7728f7f2080c061c6fa1c Mon Sep 17 00:00:00 2001 From: JUDIT GRESKOVITS Date: Thu, 9 Feb 2017 14:24:22 +0000 Subject: [PATCH 3/3] Move form creation to containers for new project --- frontend/src/containers/new-project/new-project.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/frontend/src/containers/new-project/new-project.js b/frontend/src/containers/new-project/new-project.js index ebf86b38..11d4f404 100644 --- a/frontend/src/containers/new-project/new-project.js +++ b/frontend/src/containers/new-project/new-project.js @@ -1,8 +1,6 @@ const React = require('react'); const ReactRedux = require('react-redux'); const ReduxForm = require('redux-form'); -const selectors = require('@state/selectors'); - const selectors = require('@state/selectors'); const PropTypes = require('@root/prop-types'); const CreateProject = require('@components/new-project');