1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +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){
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());
}

View File

@ -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 (<div
className={classNames(this.getCollapsibleClassSet()) + ' ascribe-settings-property'}
ref="panel">
{this.props.children}
</div>);
} 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}>
<input
onChange={this.handleChange}
type="checkbox"
ref="checkboxCollapsible"/>
{/* PLEASE LEAVE THE SPACE BETWEEN LABEL and this.props.label */}
<span className="checkbox"> {this.props.checkboxLabel}</span>
</div>
</OverlayTrigger>
{this.renderChildren()}
<div
className={classNames(this.getCollapsibleClassSet()) + ' ascribe-settings-property'}
ref="panel">
{this.renderChildren()}
</div>
</div>
);
}

View File

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