1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/public/js/components/feature/UnsavedFeature.jsx

68 lines
2.1 KiB
React
Raw Normal View History

2014-10-30 18:25:38 +01:00
var React = require('react');
var UnsavedFeature = React.createClass({
render: function() {
return (
2014-10-31 10:30:23 +01:00
<form ref="form" className="bg-blue-xlt">
<div className="line mal ptl pbl">
<div className="unit prl r-size1of6">
2014-10-30 18:25:38 +01:00
<input ref="enabled" type="checkbox" defaultValue={this.props.feature.enabled} />
</div>
2014-10-31 10:30:23 +01:00
<div className="unit r-size2of5">
2014-10-30 18:25:38 +01:00
<input
type="text"
2014-10-31 10:30:23 +01:00
className="mbs"
2014-10-30 18:25:38 +01:00
id="name"
ref="name"
defaultValue={this.props.feature.name}
placeholder="Enter name" />
2014-10-31 10:30:23 +01:00
<input className=""
type="text"
ref="description"
placeholder="Enter description" />
2014-10-30 18:25:38 +01:00
</div>
2014-10-31 10:30:23 +01:00
<div className="unit r-size2of6 plm">
2014-10-30 18:25:38 +01:00
<select id="strategy"
ref="strategy"
className=""
defaultValue={this.props.feature.strategy}>
<option value="default">default</option>
</select>
</div>
2014-10-31 10:30:23 +01:00
<div className="unit r-size1of6 rightify">
<button className="primary mrs" onClick={this.saveFeature}>
Save
</button>
2014-10-30 18:25:38 +01:00
2014-10-31 10:30:23 +01:00
<button className="" onClick={this.cancelFeature}>
Cancel
</button>
</div>
2014-10-30 18:25:38 +01:00
</div>
2014-10-31 10:30:23 +01:00
</form>
2014-10-30 18:25:38 +01:00
);
},
saveFeature: function(e) {
e.preventDefault();
this.props.feature.name = this.refs.name.getDOMNode().value;
this.props.feature.description = this.refs.description.getDOMNode().value;
this.props.feature.strategy = this.refs.strategy.getDOMNode().value;
this.props.feature.enabled = this.refs.enabled.getDOMNode().checked;
this.props.onSubmit(this.props.feature);
},
cancelFeature: function(e) {
e.preventDefault();
this.props.onCancel(this.props.feature);
}
});
module.exports = UnsavedFeature;