var React = require('react'); var _ = require('lodash'); var serverActions = require('../actions/server'); var channelActions = require('../actions/channel'); var Connect = React.createClass({ getInitialState: function() { return { showOptionals: false }; }, handleSubmit: function(e) { e.preventDefault(); var address = e.target.address.value.trim(); var nick = e.target.nick.value.trim(); var channels = _.filter(_.map(e.target.channels.value.split(','), _.trim)); var opts = { name: e.target.name.value.trim(), ssl: e.target.ssl.checked }; if (this.state.showOptionals) { opts.realname = e.target.realname.value.trim(); opts.username = e.target.username.value.trim(); opts.password = e.target.password.value.trim(); } if (address.indexOf('.') > 0 && nick) { serverActions.connect(address, nick, opts); if (channels.length > 0) { channelActions.join(channels, address); } } }, handleShowClick: function() { this.setState({ showOptionals: !this.state.showOptionals}); }, render: function() { var optionals = null; if (this.state.showOptionals) { optionals = (