'use strict'; const React = require('react'); const FeatureList = require('./FeatureList'); const FeatureForm = require('./FeatureForm'); const FeatureActions = require('../../stores/FeatureToggleActions'); const ErrorActions = require('../../stores/ErrorActions'); const FeatureTogglesComponent = React.createClass({ getInitialState () { return { createView: false, }; }, updateFeature (feature) { FeatureActions.update.triggerPromise(feature); }, archiveFeature (feature) { FeatureActions.archive.triggerPromise(feature); }, createFeature (feature) { FeatureActions.create.triggerPromise(feature) .then(this.cancelNewFeature); }, newFeature () { this.setState({ createView: true }); }, cancelNewFeature () { this.setState({ createView: false }); ErrorActions.clear(); }, render () { return (