var React = require('react'); var _ = require('lodash'); var serverActions = require('../actions/server'); var channelActions = require('../actions/channel'); var Connect = React.createClass({ handleSubmit: function(e) { e.preventDefault(); var name = e.target.name.value.trim(); var address = e.target.address.value.trim(); var ssl = e.target.ssl.checked; var nick = e.target.nick.value.trim(); var username = e.target.username.value.trim(); var channels = _.filter(_.map(e.target.channels.value.split(','), _.trim)); if (address.indexOf('.') > 0 && nick && username) { serverActions.connect(address, nick, username, ssl, name); if (channels.length > 0) { channelActions.join(channels, address); } } }, render: function() { return (