Blame view

imports/client/views/nonOrg/enter/SignupView.js 3.99 KB
ff976df49   Deepak   added orgs public...
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   Deepak   Moved all files t...
6
  import handleSignup                       from './signup';
ff976df49   Deepak   added orgs public...
7
  import { Orgs }                           from '/imports/collections/orgs/index';
2b1ad7917   tmcdeveloper   wip moving to Met...
8

3540345c5   themeteorchef   handful of fixes
9
  export default class Signup extends React.Component {
ff976df49   Deepak   added orgs public...
10
11
12
    constructor(props) {
      super(props);
      this.state = {
79c6eb079   Deepak   added validation ...
13
        orgSlug: ""
ff976df49   Deepak   added orgs public...
14
15
16
17
18
      };
    }
    componentWillMount(){
      Meteor.subscribe('allOrgsSlug');
    }
7df77f0fa   tmcdeveloper   finish wiring up ...
19
    componentDidMount() {
f0c912bf1   tmcdeveloper   add method tests ...
20
      handleSignup({ component: this });
7df77f0fa   tmcdeveloper   finish wiring up ...
21
    }
79c6eb079   Deepak   added validation ...
22
23
24
    handleChange(e) {
       this.setState({ orgSlug: e.target.value });
     }
c42d4eeac   themeteorchef   handful of changes
25
26
    handleSubmit(event) {
      event.preventDefault();
7df77f0fa   tmcdeveloper   finish wiring up ...
27
    }
79c6eb079   Deepak   added validation ...
28
    checkExistingOrgSlug() {
79c6eb079   Deepak   added validation ...
29
30
31
32
33
34
35
      if(this.state.orgSlug==""){return null}
      searchOrg = Orgs.find({slug:this.state.orgSlug}).fetch();
      if(searchOrg.length>0){
        return "error"
      }else{
        return "success"
      }
ff976df49   Deepak   added orgs public...
36
    }
7df77f0fa   tmcdeveloper   finish wiring up ...
37
    render() {
4c9b3dfc1   themeteorchef   cleaning up
38
39
40
41
42
43
44
45
46
      return (
        <div className="Signup">
          <Row>
            <Col xs={ 12 } sm={ 6 } md={ 4 }>
              <h4 className="page-header">Sign Up</h4>
              <form
                ref={ form => (this.signupForm = form) }
                onSubmit={ this.handleSubmit }
              >
ff976df49   Deepak   added orgs public...
47
48
              <Row>
              <Col xs={ 12 } sm={ 12 }>
79c6eb079   Deepak   added validation ...
49
                <FormGroup controlId="orgSlugField" validationState={this.checkExistingOrgSlug()}>
ff976df49   Deepak   added orgs public...
50
51
52
                  <ControlLabel>Organisation name</ControlLabel>
                  <InputGroup>
                    <FormControl
79c6eb079   Deepak   added validation ...
53
54
55
                      type        ="text"
                      ref         ="orgSlug"
                      name        ="orgSlug"
39d8f536d   Deepak   some more cleamup
56
                      placeholder ="School URL"
79c6eb079   Deepak   added validation ...
57
                      onChange    = {(e) => this.handleChange(e)}
ff976df49   Deepak   added orgs public...
58
59
60
61
62
63
                    />
                    <InputGroup.Addon>@yd.com</InputGroup.Addon>
                  </InputGroup>
                </FormGroup>
              </Col>
              </Row>
39d8f536d   Deepak   some more cleamup
64
65
66
67
68
69
70
71
72
73
74
75
76
              <Row>
                <Col xs={ 6 } sm={ 6 }>
                  <FormGroup>
                    <ControlLabel>First Name</ControlLabel>
                    <FormControl
                      type="text"
                      ref="orgName"
                      name="orgName"
                      placeholder="School Name"
                    />
                    </FormGroup>
                </Col>
              </Row>
4c9b3dfc1   themeteorchef   cleaning up
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
                <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   tmcdeveloper   4.1.0 release
101
                <FormGroup>
4c9b3dfc1   themeteorchef   cleaning up
102
                  <ControlLabel>Email Address</ControlLabel>
cac7cbc73   tmcdeveloper   4.1.0 release
103
104
                  <FormControl
                    type="text"
4c9b3dfc1   themeteorchef   cleaning up
105
106
107
                    ref="emailAddress"
                    name="emailAddress"
                    placeholder="Email Address"
cac7cbc73   tmcdeveloper   4.1.0 release
108
109
                  />
                </FormGroup>
cac7cbc73   tmcdeveloper   4.1.0 release
110
                <FormGroup>
4c9b3dfc1   themeteorchef   cleaning up
111
                  <ControlLabel>Password</ControlLabel>
cac7cbc73   tmcdeveloper   4.1.0 release
112
                  <FormControl
4c9b3dfc1   themeteorchef   cleaning up
113
114
115
116
                    type="password"
                    ref="password"
                    name="password"
                    placeholder="Password"
cac7cbc73   tmcdeveloper   4.1.0 release
117
118
                  />
                </FormGroup>
4c9b3dfc1   themeteorchef   cleaning up
119
120
121
122
123
124
125
                <Button type="submit" bsStyle="success">Sign Up</Button>
              </form>
              <p>Already have an account? <Link to="/login">Log In</Link>.</p>
            </Col>
          </Row>
        </div>
      );
7df77f0fa   tmcdeveloper   finish wiring up ...
126
127
    }
  }