From bc4b80c661a37e90c37eb406a229f7684dc193ad Mon Sep 17 00:00:00 2001 From: ivaosthu Date: Sat, 29 Nov 2014 11:43:41 +0100 Subject: [PATCH] 56 Clean up input form for feature toggles --- public/js/components/feature/Feature.jsx | 16 +++- public/js/components/feature/FeatureForm.jsx | 87 ++++++++++--------- public/js/components/form/TextInput.jsx | 1 + .../js/components/strategy/StrategyForm.jsx | 2 +- 4 files changed, 63 insertions(+), 43 deletions(-) diff --git a/public/js/components/feature/Feature.jsx b/public/js/components/feature/Feature.jsx index 939b2885b2..580d6351d8 100644 --- a/public/js/components/feature/Feature.jsx +++ b/public/js/components/feature/Feature.jsx @@ -68,9 +68,19 @@ var Feature = React.createClass({ {this.props.feature.strategy} - - - + +
+
+ +
+
+ +
+
{this.state.showHistory ? this.renderHistory() : this.renderEmptyRow()} diff --git a/public/js/components/feature/FeatureForm.jsx b/public/js/components/feature/FeatureForm.jsx index 243a49a62e..472d5831a5 100644 --- a/public/js/components/feature/FeatureForm.jsx +++ b/public/js/components/feature/FeatureForm.jsx @@ -1,4 +1,5 @@ var React = require('react'); +var TextInput = require('../form/TextInput'); var strategyStore = require('../../stores/StrategyStore'); var FeatureForm = React.createClass({ @@ -22,51 +23,59 @@ var FeatureForm = React.createClass({ enabled: false }; + var title = this.props.feature ? "Edit '" + this.props.feature.name + "'" : "Create new toggle"; + return ( -
-
+
+ -
- -
+
+ {title} -
- + - -
+ -
- -
+
+ +
+ +
+
-
- +
+
+
    +
  • + + +
  • +
+
+
+
- -
+
+ + +
+
- ); }, @@ -86,8 +95,8 @@ var FeatureForm = React.createClass({ e.preventDefault(); var feature = { - name: this.refs.name.getDOMNode().value, - description: this.refs.description.getDOMNode().value, + name: this.refs.name.getValue(), + description: this.refs.description.getValue(), strategy: this.refs.strategy.getDOMNode().value, enabled: this.refs.enabled.getDOMNode().checked }; diff --git a/public/js/components/form/TextInput.jsx b/public/js/components/form/TextInput.jsx index 49af299b30..687774510f 100644 --- a/public/js/components/form/TextInput.jsx +++ b/public/js/components/form/TextInput.jsx @@ -35,6 +35,7 @@ var TextInput = React.createClass({ name={this.props.name} defaultValue={this.props.value} placeholder={this.props.placeholder} + disabled={this.props.disabled} ref="input" /> diff --git a/public/js/components/strategy/StrategyForm.jsx b/public/js/components/strategy/StrategyForm.jsx index 55380f59fa..dd65827c04 100644 --- a/public/js/components/strategy/StrategyForm.jsx +++ b/public/js/components/strategy/StrategyForm.jsx @@ -58,7 +58,7 @@ var StrategyForm = React.createClass({ render: function() { return ( -
+