From 3475d07cee037d11853738461fd1dcfbeee7982b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Wed, 19 Aug 2015 16:03:59 +0200 Subject: [PATCH] Revert "form validation first cut" Tim: I reverted this commit because I want to keep if for later. We decided to do so because we're of the opinion validation is not a pressing issue right now. This reverts commit 8a814c287cd6dc85fbd63cb29518ac0e21aabfb3. --- js/components/ascribe_forms/form.js | 41 ++----------- .../ascribe_forms/form_register_piece.js | 58 ++++++------------- js/components/ascribe_forms/input_checkbox.js | 27 ++++----- js/components/ascribe_forms/property.js | 43 +++----------- .../cyland/cyland_register_piece.js | 3 +- 5 files changed, 41 insertions(+), 131 deletions(-) diff --git a/js/components/ascribe_forms/form.js b/js/components/ascribe_forms/form.js index a9e267d9..2b956a7e 100644 --- a/js/components/ascribe_forms/form.js +++ b/js/components/ascribe_forms/form.js @@ -23,8 +23,8 @@ let Form = React.createClass({ handleSuccess: React.PropTypes.func, getFormData: React.PropTypes.func, children: React.PropTypes.oneOfType([ - React.PropTypes.arrayOf(React.PropTypes.element), - React.PropTypes.element + React.PropTypes.object, + React.PropTypes.array ]), className: React.PropTypes.string, spinner: React.PropTypes.element, @@ -165,43 +165,14 @@ let Form = React.createClass({ this.setState({errors: []}); }, - checkFormValidity() { - let requiredProps = []; - - Object - .keys(this.refs) - .forEach((refName) => { - if(this.refs[refName].props.required) { - requiredProps.push(this.refs[refName]); - } - }); - - let validProps = requiredProps.filter((property) => property.state.isValid); - - if(requiredProps.length === validProps.length) { - return true; - } else { - return false; - } - - }, - getButtons() { - let buttons = null; - let isFormValid = this.checkFormValidity(); - - if(this.state.submitted) { + if (this.state.submitted){ return this.props.spinner; } - if(this.props.buttons) { - - buttons = React.cloneElement(this.props.buttons, { - disabled: !isFormValid - }); - - return buttons; + if (this.props.buttons){ + return this.props.buttons; } - + let buttons = null; if (this.state.edited){ buttons = ( diff --git a/js/components/ascribe_forms/form_register_piece.js b/js/components/ascribe_forms/form_register_piece.js index ef25dd55..6545007c 100644 --- a/js/components/ascribe_forms/form_register_piece.js +++ b/js/components/ascribe_forms/form_register_piece.js @@ -27,10 +27,7 @@ let RegisterPieceForm = React.createClass({ isFineUploaderActive: React.PropTypes.bool, isFineUploaderEditable: React.PropTypes.bool, enableLocalHashing: React.PropTypes.bool, - children: React.PropTypes.oneOfType([ - React.PropTypes.arrayOf(React.PropTypes.element), - React.PropTypes.element - ]), + children: React.PropTypes.element, onLoggedOut: React.PropTypes.func }, @@ -77,11 +74,16 @@ let RegisterPieceForm = React.createClass({ }); }, + setIsUploadReady(isReady) { + this.setState({ + isUploadReady: isReady + }); + }, + render() { let currentUser = this.state.currentUser; let enableLocalHashing = currentUser && currentUser.profile ? currentUser.profile.hash_locally : false; enableLocalHashing = enableLocalHashing && this.props.enableLocalHashing; - return (
{this.props.headerMessage} + ignoreFocus={true}> + label={getLangText('Artist Name')}> + label={getLangText('Title')}> + label={getLangText('Year Created')}> + style={{paddingBottom: 0}}> {' ' + getLangText('I agree to the Terms of Service of Cyland Archive') + ' '}