1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 09:35:10 +01:00

fix specify editions in register piece

This commit is contained in:
Tim Daubenschütz 2015-07-14 00:12:33 +02:00
parent 3cc95cf7d5
commit 6bf28dbfa4
3 changed files with 18 additions and 8 deletions

View File

@ -59,6 +59,7 @@ let Form = React.createClass({
for (let ref in this.refs){ for (let ref in this.refs){
data[this.refs[ref].props.name] = this.refs[ref].state.value; data[this.refs[ref].props.name] = this.refs[ref].state.value;
} }
console.log(data);
if ('getFormData' in this.props){ if ('getFormData' in this.props){
data = mergeOptionsWithDuplicates(data, this.props.getFormData()); data = mergeOptionsWithDuplicates(data, this.props.getFormData());
} }

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
import React from 'react'; import React from 'react';
import ReactAddons from 'react/addons';
import CollapsibleMixin from 'react-bootstrap/lib/CollapsibleMixin'; import CollapsibleMixin from 'react-bootstrap/lib/CollapsibleMixin';
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger'; import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
@ -39,15 +40,17 @@ let PropertyCollapsile = React.createClass({
}); });
}, },
handleChange(event) {
this.setState({value: event.target.value});
},
renderChildren() { renderChildren() {
if(this.state.show) { if(this.state.show) {
return (<div return ReactAddons.Children.map(this.props.children, (child) => {
className={classNames(this.getCollapsibleClassSet()) + ' ascribe-settings-property'} return ReactAddons.addons.cloneWithProps(child, {
ref="panel"> onChange: this.handleChange
{this.props.children} });
</div>); });
} else {
return null;
} }
}, },
@ -75,14 +78,19 @@ let PropertyCollapsile = React.createClass({
onClick={this.handleFocus} onClick={this.handleFocus}
onFocus={this.handleFocus}> onFocus={this.handleFocus}>
<input <input
onChange={this.handleChange}
type="checkbox" type="checkbox"
ref="checkboxCollapsible"/> ref="checkboxCollapsible"/>
{/* PLEASE LEAVE THE SPACE BETWEEN LABEL and this.props.label */} {/* PLEASE LEAVE THE SPACE BETWEEN LABEL and this.props.label */}
<span className="checkbox"> {this.props.checkboxLabel}</span> <span className="checkbox"> {this.props.checkboxLabel}</span>
</div> </div>
</OverlayTrigger> </OverlayTrigger>
<div
className={classNames(this.getCollapsibleClassSet()) + ' ascribe-settings-property'}
ref="panel">
{this.renderChildren()} {this.renderChildren()}
</div> </div>
</div>
); );
} }
}); });

View File

@ -139,6 +139,7 @@ let RegisterPiece = React.createClass( {
if (this.props.canSpecifyEditions) { if (this.props.canSpecifyEditions) {
return ( return (
<PropertyCollapsible <PropertyCollapsible
name="num_editions"
checkboxLabel={getLangText('Specify editions')}> checkboxLabel={getLangText('Specify editions')}>
<span>{getLangText('Editions')}</span> <span>{getLangText('Editions')}</span>
<input <input