var React = require('react'); var FeatureForm = require('./FeatureForm'); var LogEntryList = require('../log/LogEntryList'); var eventStore = require('../../stores/EventStore'); var Feature = React.createClass({ getInitialState: function() { return { editMode: false, showHistory: false, events: [] }; }, handleEventsResponse: function(response) { this.setState({events: response}); }, toggleHistory: function() { eventStore.getEventsByName(this.props.feature.name).then(this.handleEventsResponse); this.setState({showHistory: !this.state.showHistory}); }, toggleEditMode: function() { this.setState({editMode: !this.state.editMode}); }, saveFeature: function(feature) { this.props.onChange(feature); this.toggleEditMode(); }, renderEditMode: function() { return ( ); }, render: function() { return ( {this.props.feature.name} {this.props.feature.description || '\u00a0'} {this.props.feature.strategy}
{this.state.editMode ? this.renderEditMode() : this.renderEmptyRow()} {this.state.showHistory ? this.renderHistory() : this.renderEmptyRow()} ); }, renderEmptyRow: function() { return (); }, renderHistory: function() { return ( ); } }); module.exports = Feature;