Blame view
imports/client/views/nonOrg/enter/SignupView.js
4 KB
ff976df49
|
1 2 3 4 5 |
import React from 'react'; import { Link } from 'react-router'; import { Row, Col, FormGroup, ControlLabel, FormControl, InputGroup, Button } from 'react-bootstrap'; |
cc8fd8a94
|
6 |
import handleSignup from './signup'; |
ff976df49
|
7 |
import { Orgs } from '/imports/collections/orgs/index'; |
fec06a896
|
8 |
import './signup.css'; |
2b1ad7917
|
9 |
|
3540345c5
|
10 |
export default class Signup extends React.Component { |
ff976df49
|
11 12 13 |
constructor(props) { super(props); this.state = { |
79c6eb079
|
14 |
orgSlug: "" |
ff976df49
|
15 16 17 18 19 |
}; } componentWillMount(){ Meteor.subscribe('allOrgsSlug'); } |
7df77f0fa
|
20 |
componentDidMount() { |
f0c912bf1
|
21 |
handleSignup({ component: this }); |
7df77f0fa
|
22 |
} |
79c6eb079
|
23 24 25 |
handleChange(e) { this.setState({ orgSlug: e.target.value }); } |
c42d4eeac
|
26 27 |
handleSubmit(event) { event.preventDefault(); |
7df77f0fa
|
28 |
} |
79c6eb079
|
29 |
checkExistingOrgSlug() { |
79c6eb079
|
30 31 32 33 34 35 36 |
if(this.state.orgSlug==""){return null} searchOrg = Orgs.find({slug:this.state.orgSlug}).fetch(); if(searchOrg.length>0){ return "error" }else{ return "success" } |
ff976df49
|
37 |
} |
7df77f0fa
|
38 |
render() { |
4c9b3dfc1
|
39 40 41 |
return ( <div className="Signup"> <Row> |
fec06a896
|
42 |
<Col md={ 12 }> |
4c9b3dfc1
|
43 44 45 46 47 |
<h4 className="page-header">Sign Up</h4> <form ref={ form => (this.signupForm = form) } onSubmit={ this.handleSubmit } > |
ff976df49
|
48 |
<Row> |
fec06a896
|
49 |
<Col xs={ 10 } sm={ 10 }> |
79c6eb079
|
50 |
<FormGroup controlId="orgSlugField" validationState={this.checkExistingOrgSlug()}> |
fec06a896
|
51 |
<ControlLabel>Organisation URL</ControlLabel> |
ff976df49
|
52 53 |
<InputGroup> <FormControl |
79c6eb079
|
54 55 56 |
type ="text" ref ="orgSlug" name ="orgSlug" |
fec06a896
|
57 |
placeholder ="Organisation URL" |
79c6eb079
|
58 |
onChange = {(e) => this.handleChange(e)} |
ff976df49
|
59 60 61 62 63 64 |
/> <InputGroup.Addon>@yd.com</InputGroup.Addon> </InputGroup> </FormGroup> </Col> </Row> |
39d8f536d
|
65 66 67 |
<Row> <Col xs={ 6 } sm={ 6 }> <FormGroup> |
fec06a896
|
68 |
<ControlLabel>Organisation Name</ControlLabel> |
39d8f536d
|
69 70 71 72 |
<FormControl type="text" ref="orgName" name="orgName" |
fec06a896
|
73 |
placeholder="Organisation Name" |
39d8f536d
|
74 75 76 77 |
/> </FormGroup> </Col> </Row> |
4c9b3dfc1
|
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
<Row> <Col xs={ 6 } sm={ 6 }> <FormGroup> <ControlLabel>First Name</ControlLabel> <FormControl type="text" ref="firstName" name="firstName" placeholder="First Name" /> </FormGroup> </Col> <Col xs={ 6 } sm={ 6 }> <FormGroup> <ControlLabel>Last Name</ControlLabel> <FormControl type="text" ref="lastName" name="lastName" placeholder="Last Name" /> </FormGroup> </Col> </Row> |
cac7cbc73
|
102 |
<FormGroup> |
4c9b3dfc1
|
103 |
<ControlLabel>Email Address</ControlLabel> |
cac7cbc73
|
104 105 |
<FormControl type="text" |
4c9b3dfc1
|
106 107 108 |
ref="emailAddress" name="emailAddress" placeholder="Email Address" |
cac7cbc73
|
109 110 |
/> </FormGroup> |
cac7cbc73
|
111 |
<FormGroup> |
4c9b3dfc1
|
112 |
<ControlLabel>Password</ControlLabel> |
cac7cbc73
|
113 |
<FormControl |
4c9b3dfc1
|
114 115 116 117 |
type="password" ref="password" name="password" placeholder="Password" |
cac7cbc73
|
118 119 |
/> </FormGroup> |
eda2656b2
|
120 |
{/* <Col md={12} */} |
d5b679c21
|
121 |
<Button type="submit" style={{float: 'right'}} bsStyle="success">Sign Up</Button> |
eda2656b2
|
122 |
|
4c9b3dfc1
|
123 |
</form> |
fec06a896
|
124 |
</Col> |
4c9b3dfc1
|
125 126 127 |
</Row> </div> ); |
7df77f0fa
|
128 129 |
} } |