diff --git a/lib/strategyApi.js b/lib/strategyApi.js index 83b8bfae57..0cf580be20 100644 --- a/lib/strategyApi.js +++ b/lib/strategyApi.js @@ -1,9 +1,13 @@ var strategies = [ - {name: "default"}, { - name: "activeForUsers", + name: "default", + description: "Default on or off Strategy." + }, + { + name: "usersWithEmail", + description: "Active for users defined in the comma-separated emails-parameter.", parametersTemplate: { - userNames: "String" + emails: "String" } } ]; diff --git a/public/js/components/form/TextInput.jsx b/public/js/components/form/TextInput.jsx new file mode 100644 index 0000000000..739a9bf429 --- /dev/null +++ b/public/js/components/form/TextInput.jsx @@ -0,0 +1,45 @@ +var React = require('react'); + +var TextInput = React.createClass({ + propTypes: { + name: React.PropTypes.string.isRequired, + label: React.PropTypes.string.isRequired, + id: React.PropTypes.string.isRequired, + placeholder: React.PropTypes.string, + value: React.PropTypes.string, + required: React.PropTypes.bool + }, + + getDefaultProps: function() { + return { + required: false + }; + }, + + getInitialState: function() { + return {}; + }, + + getValue: function() { + return this.refs.input.getDOMNode().value.trim(); + }, + + + render: function() { + return ( +
+ +
+ +
+
+ ); + } +}); + +module.exports = TextInput; \ No newline at end of file diff --git a/public/js/components/strategy/Strategy.jsx b/public/js/components/strategy/Strategy.jsx index d1fb019740..096a2f099c 100644 --- a/public/js/components/strategy/Strategy.jsx +++ b/public/js/components/strategy/Strategy.jsx @@ -8,8 +8,9 @@ var Strategy = React.createClass({ render: function() { return (
-
- {this.props.strategy.name} +
+ {this.props.strategy.name}
+ {this.props.strategy.description}
); diff --git a/public/js/components/strategy/StrategyForm.jsx b/public/js/components/strategy/StrategyForm.jsx index d153c0d339..2a46c3f790 100644 --- a/public/js/components/strategy/StrategyForm.jsx +++ b/public/js/components/strategy/StrategyForm.jsx @@ -1,4 +1,5 @@ var React = require('react'); +var TextInput = require('../form/TextInput'); var StrategyForm = React.createClass({ @@ -18,7 +19,8 @@ var StrategyForm = React.createClass({ event.preventDefault(); var strategy = {}; - strategy.name = this.refs.strategy_name.getDOMNode().value.trim(); + strategy.name = this.refs.name.getValue(); + strategy.description = this.refs.description.getValue(); strategy.parametersTemplate = {}; var that = this; @@ -55,23 +57,24 @@ var StrategyForm = React.createClass({
Create strategy -
- -
- -
-
+ + + + {this.renderParameters()} {this.renderRemoveLink()} -