Commit d5b679c21a2918788e81afbb1fa6a1cf62678584

Authored by Deepak
1 parent ad09bdf6a1
Exists in master

fixed style

imports/client/views/nonOrg/enter/SignupView.js
1 import React from 'react'; 1 import React from 'react';
2 import { Link } from 'react-router'; 2 import { Link } from 'react-router';
3 import { Row, Col, FormGroup, 3 import { Row, Col, FormGroup,
4 ControlLabel, FormControl, 4 ControlLabel, FormControl,
5 InputGroup, Button } from 'react-bootstrap'; 5 InputGroup, Button } from 'react-bootstrap';
6 import handleSignup from './signup'; 6 import handleSignup from './signup';
7 import { Orgs } from '/imports/collections/orgs/index'; 7 import { Orgs } from '/imports/collections/orgs/index';
8 import './signup.css'; 8 import './signup.css';
9 9
10 export default class Signup extends React.Component { 10 export default class Signup extends React.Component {
11 constructor(props) { 11 constructor(props) {
12 super(props); 12 super(props);
13 this.state = { 13 this.state = {
14 orgSlug: "" 14 orgSlug: ""
15 }; 15 };
16 } 16 }
17 componentWillMount(){ 17 componentWillMount(){
18 Meteor.subscribe('allOrgsSlug'); 18 Meteor.subscribe('allOrgsSlug');
19 } 19 }
20 20
21 componentDidMount() { 21 componentDidMount() {
22 handleSignup({ component: this }); 22 handleSignup({ component: this });
23 } 23 }
24 handleChange(e) { 24 handleChange(e) {
25 this.setState({ orgSlug: e.target.value }); 25 this.setState({ orgSlug: e.target.value });
26 } 26 }
27 handleSubmit(event) { 27 handleSubmit(event) {
28 event.preventDefault(); 28 event.preventDefault();
29 } 29 }
30 checkExistingOrgSlug() { 30 checkExistingOrgSlug() {
31 if(this.state.orgSlug==""){return null} 31 if(this.state.orgSlug==""){return null}
32 searchOrg = Orgs.find({slug:this.state.orgSlug}).fetch(); 32 searchOrg = Orgs.find({slug:this.state.orgSlug}).fetch();
33 if(searchOrg.length>0){ 33 if(searchOrg.length>0){
34 return "error" 34 return "error"
35 }else{ 35 }else{
36 return "success" 36 return "success"
37 } 37 }
38 } 38 }
39 render() { 39 render() {
40 return ( 40 return (
41 <div className="Signup"> 41 <div className="Signup">
42 <Row> 42 <Row>
43 <Col md={ 12 }> 43 <Col md={ 12 }>
44 <h4 className="page-header">Sign Up</h4> 44 <h4 className="page-header">Sign Up</h4>
45 <form 45 <form
46 ref={ form => (this.signupForm = form) } 46 ref={ form => (this.signupForm = form) }
47 onSubmit={ this.handleSubmit } 47 onSubmit={ this.handleSubmit }
48 > 48 >
49 <Row> 49 <Row>
50 <Col xs={ 10 } sm={ 10 }> 50 <Col xs={ 10 } sm={ 10 }>
51 <FormGroup controlId="orgSlugField" validationState={this.checkExistingOrgSlug()}> 51 <FormGroup controlId="orgSlugField" validationState={this.checkExistingOrgSlug()}>
52 <ControlLabel>Organisation URL</ControlLabel> 52 <ControlLabel>Organisation URL</ControlLabel>
53 <InputGroup> 53 <InputGroup>
54 <FormControl 54 <FormControl
55 type ="text" 55 type ="text"
56 ref ="orgSlug" 56 ref ="orgSlug"
57 name ="orgSlug" 57 name ="orgSlug"
58 placeholder ="Organisation URL" 58 placeholder ="Organisation URL"
59 onChange = {(e) => this.handleChange(e)} 59 onChange = {(e) => this.handleChange(e)}
60 /> 60 />
61 <InputGroup.Addon>@yd.com</InputGroup.Addon> 61 <InputGroup.Addon>@yd.com</InputGroup.Addon>
62 </InputGroup> 62 </InputGroup>
63 </FormGroup> 63 </FormGroup>
64 </Col> 64 </Col>
65 </Row> 65 </Row>
66 <Row> 66 <Row>
67 <Col xs={ 6 } sm={ 6 }> 67 <Col xs={ 6 } sm={ 6 }>
68 <FormGroup> 68 <FormGroup>
69 <ControlLabel>Organisation Name</ControlLabel> 69 <ControlLabel>Organisation Name</ControlLabel>
70 <FormControl 70 <FormControl
71 type="text" 71 type="text"
72 ref="orgName" 72 ref="orgName"
73 name="orgName" 73 name="orgName"
74 placeholder="Organisation Name" 74 placeholder="Organisation Name"
75 /> 75 />
76 </FormGroup> 76 </FormGroup>
77 </Col> 77 </Col>
78 </Row> 78 </Row>
79 <Row> 79 <Row>
80 <Col xs={ 6 } sm={ 6 }> 80 <Col xs={ 6 } sm={ 6 }>
81 <FormGroup> 81 <FormGroup>
82 <ControlLabel>First Name</ControlLabel> 82 <ControlLabel>First Name</ControlLabel>
83 <FormControl 83 <FormControl
84 type="text" 84 type="text"
85 ref="firstName" 85 ref="firstName"
86 name="firstName" 86 name="firstName"
87 placeholder="First Name" 87 placeholder="First Name"
88 /> 88 />
89 </FormGroup> 89 </FormGroup>
90 </Col> 90 </Col>
91 <Col xs={ 6 } sm={ 6 }> 91 <Col xs={ 6 } sm={ 6 }>
92 <FormGroup> 92 <FormGroup>
93 <ControlLabel>Last Name</ControlLabel> 93 <ControlLabel>Last Name</ControlLabel>
94 <FormControl 94 <FormControl
95 type="text" 95 type="text"
96 ref="lastName" 96 ref="lastName"
97 name="lastName" 97 name="lastName"
98 placeholder="Last Name" 98 placeholder="Last Name"
99 /> 99 />
100 </FormGroup> 100 </FormGroup>
101 </Col> 101 </Col>
102 </Row> 102 </Row>
103 <FormGroup> 103 <FormGroup>
104 <ControlLabel>Email Address</ControlLabel> 104 <ControlLabel>Email Address</ControlLabel>
105 <FormControl 105 <FormControl
106 type="text" 106 type="text"
107 ref="emailAddress" 107 ref="emailAddress"
108 name="emailAddress" 108 name="emailAddress"
109 placeholder="Email Address" 109 placeholder="Email Address"
110 /> 110 />
111 </FormGroup> 111 </FormGroup>
112 <FormGroup> 112 <FormGroup>
113 <ControlLabel>Password</ControlLabel> 113 <ControlLabel>Password</ControlLabel>
114 <FormControl 114 <FormControl
115 type="password" 115 type="password"
116 ref="password" 116 ref="password"
117 name="password" 117 name="password"
118 placeholder="Password" 118 placeholder="Password"
119 /> 119 />
120 </FormGroup> 120 </FormGroup>
121 {/* <Col md={12} */} 121 {/* <Col md={12} */}
122 <Button type="submit" style="float:center" bsStyle="success">Sign Up</Button> 122 <Button type="submit" style={{float: 'right'}} bsStyle="success">Sign Up</Button>
123 123
124 </form> 124 </form>
125 </Col> 125 </Col>
126 </Row> 126 </Row>
127 </div> 127 </div>
128 ); 128 );
129 } 129 }
130 } 130 }
131 131
imports/client/views/org/admin/students/UploadCsv.js
1 import _ from 'lodash'; 1 import _ from 'lodash';
2 import { Meteor } from 'meteor/meteor'; 2 import { Meteor } from 'meteor/meteor';
3 3
4 import React, { Component } from 'react'; 4 import React, { Component } from 'react';
5 import { Link,browserHistory } from 'react-router'; 5 import { Link,browserHistory } from 'react-router';
6 import { FormGroup,Panel,Table, 6 import { FormGroup,Panel,Table,
7 ButtonToolbar,Modal,ControlLabel,HelpBlock, 7 ButtonToolbar,Modal,ControlLabel,HelpBlock,
8 FormControl,Glyphicon,Button } from 'react-bootstrap'; 8 FormControl,Glyphicon,Button } from 'react-bootstrap';
9 // import { AddStudentForm } from './addStudentForm'; 9 // import { AddStudentForm } from './addStudentForm';
10 10
11 const style = { 11 const style = {
12 margin: 12, 12 margin: 12,
13 }; 13 };
14 function FieldGroup({ id, label, help, ...props }) { 14 function FieldGroup({ id, label, help, ...props }) {
15 return ( 15 return (
16 <FormGroup controlId={id}> 16 <FormGroup controlId={id}>
17 <ControlLabel>{label}</ControlLabel> 17 <ControlLabel>{label}</ControlLabel>
18 <FormControl {...props} /> 18 <FormControl {...props} />
19 {help && <HelpBlock>{help}</HelpBlock>} 19 {help && <HelpBlock>{help}</HelpBlock>}
20 </FormGroup> 20 </FormGroup>
21 ); 21 );
22 } 22 }
23 export class UploadCsv extends Component { 23 export class UploadCsv extends Component {
24 constructor(props) { 24 constructor(props) {
25 super(props); 25 super(props);
26 this.state = { 26 this.state = {
27 show: false 27 show: false
28 }; 28 };
29 this.showModal = this.showModal.bind(this); 29 this.showModal = this.showModal.bind(this);
30 this.hideModal = this.hideModal.bind(this); 30 this.hideModal = this.hideModal.bind(this);
31 this.onUpdate = this.onUpdate.bind(this); 31 this.onUpdate = this.onUpdate.bind(this);
32 }; 32 };
33 33
34 showModal() { 34 showModal() {
35 this.setState({show: true}); 35 this.setState({show: true});
36 } 36 }
37 37
38 hideModal() { 38 hideModal() {
39 this.setState({show: false}); 39 this.setState({show: false});
40 } 40 }
41 onUpdate(key, value) { 41 onUpdate(key, value) {
42 this.setState({[key]: value}); 42 this.setState({[key]: value});
43 }; 43 };
44 44
45 render() { 45 render() {
46 console.log(this.props); 46 console.log(this.props);
47 return ( 47 return (
48 <ButtonToolbar> 48 <ButtonToolbar>
49 <Button bsStyle="primary" onClick={this.showModal}> 49 <Button bsStyle="primary" onClick={this.showModal}>
50 Upload CSV 50 Upload CSV
51 </Button> 51 </Button>
52 <Modal 52 <Modal
53 {...this.props} 53 {...this.props}
54 show={this.state.show} 54 show={this.state.show}
55 onHide={this.hideModal} 55 onHide={this.hideModal}
56 dialogClassName="custom-modal" 56 dialogClassName="custom-modal"
57 > 57 >
58 <Modal.Header closeButton> 58 <Modal.Header closeButton>
59 <Modal.Title id="contained-modal-title-lg">New Student</Modal.Title> 59 <Modal.Title id="contained-modal-title-lg">New Student</Modal.Title>
60 </Modal.Header> 60 </Modal.Header>
61 <Modal.Body> 61 <Modal.Body>
62 <form> 62 <form>
63 <FieldGroup 63 <FieldGroup
64 id="formControlsFile" 64 id="formControlsFile"
65 type="file" 65 type="file"
66 label="File" 66 label="File"
67 help="Example block-level help text here." 67 help="Upload you CSV here."
68 /> 68 />
69 </form> 69 </form>
70 </Modal.Body> 70 </Modal.Body>
71 <Modal.Footer> 71 <Modal.Footer>
72 <Button onClick={this.hideModal}>Close</Button> 72 <Button onClick={this.hideModal}>Close</Button>
73 </Modal.Footer> 73 </Modal.Footer>
74 </Modal> 74 </Modal>
75 </ButtonToolbar> 75 </ButtonToolbar>
76 ); 76 );
77 }; 77 };
78 78
79 }; 79 };
80 80