diff --git a/public/js/components/feature/Feature.jsx b/public/js/components/feature/Feature.jsx index 9105dc732a..939b2885b2 100644 --- a/public/js/components/feature/Feature.jsx +++ b/public/js/components/feature/Feature.jsx @@ -68,8 +68,8 @@ var Feature = React.createClass({ {this.props.feature.strategy} - - + + diff --git a/public/js/components/feature/FeatureForm.jsx b/public/js/components/feature/FeatureForm.jsx index a0ea72b344..783db336b7 100644 --- a/public/js/components/feature/FeatureForm.jsx +++ b/public/js/components/feature/FeatureForm.jsx @@ -11,23 +11,11 @@ var FeatureForm = React.createClass({ }, handleStrategyResponse: function(response) { - var strategyNames = response.strategies.map(function(strategy) { - return strategy.name; - }); - + var strategyNames = response.strategies.map(function(s) { return s.name; }); this.setState({strategyOptions: strategyNames}); }, render: function() { - var currentStrategy = this.props.feature ? this.props.feature.strategy : ""; - var strategyNodes = this.state.strategyOptions.map(function(name) { - return ( - - ); - }); - var feature = this.props.feature || { name: '', strategy: 'default', @@ -64,7 +52,7 @@ var FeatureForm = React.createClass({ ref="strategy" className="" defaultValue={feature.strategy}> - {strategyNodes} + {this.renderStrategyOptions()} @@ -82,6 +70,18 @@ var FeatureForm = React.createClass({ ); }, + renderStrategyOptions: function() { + var currentStrategy = this.props.feature ? this.props.feature.strategy : ""; + + return this.state.strategyOptions.map(function(name) { + return ( + + ); + }); + }, + saveFeature: function(e) { e.preventDefault(); @@ -90,7 +90,7 @@ var FeatureForm = React.createClass({ description: this.refs.description.getDOMNode().value, strategy: this.refs.strategy.getDOMNode().value, enabled: this.refs.enabled.getDOMNode().checked - } + }; this.props.onSubmit(feature); }, diff --git a/public/js/components/strategy/StrategyForm.jsx b/public/js/components/strategy/StrategyForm.jsx index 4c6e66679a..55380f59fa 100644 --- a/public/js/components/strategy/StrategyForm.jsx +++ b/public/js/components/strategy/StrategyForm.jsx @@ -35,6 +35,12 @@ var StrategyForm = React.createClass({ this.props.onSave(strategy); }, + onCancel: function(event) { + event.preventDefault(); + + this.props.onCancelNewStrategy(); + }, + onAddParam: function(event) { event.preventDefault(); var id = this.state.parameters.length + 1; @@ -70,14 +76,14 @@ var StrategyForm = React.createClass({ name="description" label="Description" ref="description" - placeholder="Please write a short descriptio" /> + placeholder="Please write a short description" /> {this.renderParameters()} {this.renderRemoveLink()}
- + {this.renderAddLink()}