From 6bf28dbfa4cce3dc4efbfa830e392c8bbb90ffd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Tue, 14 Jul 2015 00:12:33 +0200 Subject: [PATCH] fix specify editions in register piece --- js/components/ascribe_forms/form.js | 1 + .../ascribe_forms/property_collapsible.js | 24 ++++++++++++------- js/components/register_piece.js | 1 + 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/js/components/ascribe_forms/form.js b/js/components/ascribe_forms/form.js index 7e0d6b42..e051928d 100644 --- a/js/components/ascribe_forms/form.js +++ b/js/components/ascribe_forms/form.js @@ -59,6 +59,7 @@ let Form = React.createClass({ for (let ref in this.refs){ data[this.refs[ref].props.name] = this.refs[ref].state.value; } + console.log(data); if ('getFormData' in this.props){ data = mergeOptionsWithDuplicates(data, this.props.getFormData()); } diff --git a/js/components/ascribe_forms/property_collapsible.js b/js/components/ascribe_forms/property_collapsible.js index d2cd0f95..ba6c0a1e 100644 --- a/js/components/ascribe_forms/property_collapsible.js +++ b/js/components/ascribe_forms/property_collapsible.js @@ -1,6 +1,7 @@ 'use strict'; import React from 'react'; +import ReactAddons from 'react/addons'; import CollapsibleMixin from 'react-bootstrap/lib/CollapsibleMixin'; import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger'; @@ -39,15 +40,17 @@ let PropertyCollapsile = React.createClass({ }); }, + handleChange(event) { + this.setState({value: event.target.value}); + }, + renderChildren() { if(this.state.show) { - return (
- {this.props.children} -
); - } else { - return null; + return ReactAddons.Children.map(this.props.children, (child) => { + return ReactAddons.addons.cloneWithProps(child, { + onChange: this.handleChange + }); + }); } }, @@ -75,13 +78,18 @@ let PropertyCollapsile = React.createClass({ onClick={this.handleFocus} onFocus={this.handleFocus}> {/* PLEASE LEAVE THE SPACE BETWEEN LABEL and this.props.label */} {this.props.checkboxLabel} - {this.renderChildren()} +
+ {this.renderChildren()} +
); } diff --git a/js/components/register_piece.js b/js/components/register_piece.js index d581f951..16687eb4 100644 --- a/js/components/register_piece.js +++ b/js/components/register_piece.js @@ -139,6 +139,7 @@ let RegisterPiece = React.createClass( { if (this.props.canSpecifyEditions) { return ( {getLangText('Editions')}