var React = require('react'); var ReactBootstrap = require('react-bootstrap'); var Alert = ReactBootstrap.Alert; var FormGroup = ReactBootstrap.FormGroup; var FormControl = ReactBootstrap.FormControl; var Button = ReactBootstrap.Button; var DropdownButton = ReactBootstrap.DropdownButton; var MenuItem = ReactBootstrap.MenuItem; var Row = ReactBootstrap.Row; var Col = ReactBootstrap.Col; var ReactDOM = require('react-dom'); var User = require('../models').User; class LoginBar extends React.Component { constructor() { super(); this.state = {username: '', password: ''}; this.onSubmit = this.handleSubmit.bind(this); this.onNewUserSubmit = this.handleNewUserSubmit.bind(this); } onUsernameChange(e) { this.setState({username: e.target.value}); } onPasswordChange(e) { this.setState({password: e.target.value}); } handleSubmit(e) { var user = new User(); e.preventDefault(); user.Username = ReactDOM.findDOMNode(this.refs.username).value; user.Password = ReactDOM.findDOMNode(this.refs.password).value; this.props.onLogin(user); } handleNewUserSubmit(e) { e.preventDefault(); this.props.onCreateNewUser(); } render() { return (
); } } class LogoutBar extends React.Component { constructor() { super(); this.onSelect = this.handleOnSelect.bind(this); } handleOnSelect(key) { if (key == 1) { if (this.props.onAccountSettings != null) this.props.onAccountSettings(); } else if (key == 2) { this.props.onLogout(); } } render() { var signedInString = "Signed in as "+this.props.user.Name; return (Error {this.props.error.ErrorId}: {this.props.error.ErrorString}