var React = require('react/addons') var ReactRouter = require('react-router') var CodeEditor = require('./CodeEditor') var Catalyst = require('../Mixins/Catalyst') var Select = require('react-select') var request = require('superagent') var getOptions = function (input, callback) { request .get('http://localhost:8000/tags/search') .query({name: input}) .send() .end(function (err, res) { if (err) { callback(err) return } callback(null, { options: res.body.map(function (tag) { return { label: tag.name, value: tag.name } }), complete: true }) }) } var BlueprintForm = React.createClass({ mixins: [Catalyst.LinkedStateMixin, ReactRouter.State], propTypes: { close: React.PropTypes.func }, getInitialState: function () { return { blueprint: { title: '', content: '', Tags: [] } } }, componentDidMount: function () { React.findDOMNode(this.refs.title).focus() }, handleTagsChange: function (selected, all) { var blueprint = this.state.blueprint blueprint.Tags = all this.setState({blueprint: blueprint}) }, handleContentChange: function (e, value) { var blueprint = this.state.blueprint blueprint.content = value this.setState({blueprint: blueprint}) }, submit: function () { console.log(this.state.blueprint) }, render: function () { return (