Commit a8c5a7fb6d807c52c4d119ddb806d2c99e347edb

Authored by Deepak
1 parent 0d80eac236
Exists in master

added teachers view

imports/client/app/routes.js
... ... @@ -23,6 +23,7 @@ import { importCsvController } from '/imports/client/views/org/impo
23 23  
24 24 //admin
25 25 import { StudentDataController } from '/imports/client/views/org/admin/students/index'
  26 +import { teachersViewController } from '/imports/client/views/org/admin/teachers/index'
26 27 //students
27 28  
28 29 //teachers
... ... @@ -52,7 +53,8 @@ const getOrgRoutes = () => (
52 53 <Route path="/" component={ App }>
53 54 <IndexRoute name="index" component={ AppModule } />
54 55 <Route name="import" path="/import" component={ importCsvController } />
55   - <Route name="student" path="/students" component={ StudentDataController } />
  56 + <Route name="student" path="/students" component={ StudentDataController } />
  57 + <Route name="teachers" path="/teachers" component={ teachersViewController } />
56 58 <Route path="*" component={ NotFound } />
57 59 </Route>
58 60 </Router>
... ...
imports/client/layouts/NonOrgApp.js
1 1 import React, { Component } from 'react';
2 2 import { Grid } from 'react-bootstrap';
3   -import {AppNavigationController} from '/imports/client/views/org/app/module/navigation/index';
  3 +import {AppNavigationController} from '/imports/client/views/nonOrg/app/module/navigation/index';
4 4 /**
5 5 * user based redirection will take place here
6 6 */
... ...
imports/client/views/etc/index.js
... ... @@ -9,6 +9,7 @@ import { Loading } from &#39;/imports/client/components/Loadi
9 9  
10 10 import { Orgs } from '/imports/collections/orgs/index';
11 11 import { Users } from '/imports/collections/users/index';
  12 +import { teachersView } from './teachersView';
12 13  
13 14 const meteorTick = (props, onData) => {
14 15  
... ...
imports/client/views/etc/signup.js
... ... @@ -3,7 +3,7 @@ import { Meteor } from &#39;meteor/meteor&#39;;
3 3  
4 4 import React, { Component } from 'react';
5 5 import { Link,browserHistory } from 'react-router';
6   -import { FormGroup,,
  6 +import { FormGroup,
7 7 FormControl,Glyphicon,Button } from 'react-bootstrap';
8 8  
9 9  
... ...
imports/client/views/nonOrg/app/module/navigation/AppNavigation.js
1   -import React from 'react';
2   -import { Navbar } from 'react-bootstrap';
3   -import { Link } from 'react-router';
4   -import PublicNavigation from './PublicNavigation.js';
5   -import AuthenticatedNavigation from './AuthenticatedNavigation.js';
  1 +import React, { Component } from 'react';
  2 +import { Navbar } from 'react-bootstrap';
  3 +import { Link } from 'react-router';
  4 +import {PublicNavigation} from './PublicNavigation.js';
  5 +import {AuthenticatedNavigation} from './AuthenticatedNavigation.js';
  6 +// import '/imports/client/assets/css/icons/icomoon/styles.css';
  7 +// import '/imports/client/assets/css/bootstrap.css';
  8 +// import '/imports/client/assets/css/core.css';
  9 +// import '/imports/client/assets/css/components.css';
  10 +// import '/imports/client/assets/css/colors.css';
  11 +// import '/imports/client/assets/css/colors.css';
  12 +export class AppNavigation extends Component {
6 13  
7   -const renderNavigation = hasUser => (hasUser ? <AuthenticatedNavigation /> : <PublicNavigation />);
  14 + constructor(props) {
  15 + super(props);
  16 + this.state = {
8 17  
9   -const AppNavigation = ({ hasUser }) => (
10   - <Navbar>
11   - <Navbar.Header>
12   - <Navbar.Brand>
13   - <Link to="/">Application Name</Link>
14   - </Navbar.Brand>
15   - <Navbar.Toggle />
16   - </Navbar.Header>
17   - <Navbar.Collapse>
18   - { renderNavigation(hasUser) }
19   - </Navbar.Collapse>
20   - </Navbar>
21   -);
  18 + };
  19 + };
22 20  
23   -AppNavigation.propTypes = {
24   - hasUser: React.PropTypes.object,
25   -};
  21 + onUpdate(key, value) {
  22 + this.setState({[key]: value});
  23 + };
  24 + render() {
  25 + const {user} = this.props.data;
  26 + if(user){
  27 + return(
  28 + <AuthenticatedNavigation
  29 + data = {this.props.data}
  30 + />
  31 + )
  32 + }else{
  33 + return(
  34 + <Navbar>
  35 + <Navbar.Header>
  36 + <Navbar.Brand>
  37 + <Link to="/">Application Name</Link>
  38 + </Navbar.Brand>
  39 + <Navbar.Toggle />
  40 + </Navbar.Header>
  41 + <Navbar.Collapse>
  42 + <PublicNavigation />
  43 + </Navbar.Collapse>
  44 + </Navbar>
  45 +
  46 + )
  47 + }
26 48  
27   -export default AppNavigation;
  49 + return (
  50 + <div></div>
  51 + );
  52 + };
  53 +
  54 +};
... ...
imports/client/views/nonOrg/app/module/navigation/index.js
1   -import { composeWithTracker } from 'react-komposer';
2   -import { Meteor } from 'meteor/meteor';
3   -import AppNavigation from '../components/AppNavigation.js';
  1 +// import { AppNavigation } from '/imports/client/views/nonOrg/app/module/navigation/index'
  2 +import _ from 'lodash';
  3 +import {
  4 + composeWithTracker,
  5 + compose,
  6 + composeAll
  7 + } from 'react-komposer';
  8 +import { Loading } from '/imports/client/components/Loading';
4 9  
5   -const composer = (props, onData) => onData(null, { hasUser: Meteor.user() });
  10 +import { Orgs } from '/imports/collections/orgs/index';
  11 +import { Users } from '/imports/collections/users/index';
6 12  
7   -export default composeWithTracker(composer, {}, {}, { pure: false })(AppNavigation);
  13 +import { AppNavigation } from './AppNavigation';
  14 +
  15 +const meteorTick = (props, onData) => {
  16 +
  17 + const handles = [
  18 + Meteor.subscribe('users.current'),
  19 + Meteor.subscribe('orgs.current')
  20 + ];
  21 +
  22 + if(_.every(handles, (handle) => (handle.ready()) )) {
  23 + const user = Users.current();
  24 + const org = Orgs.current();
  25 + onData(null, {
  26 + data: {
  27 + user: user,
  28 + org: org
  29 + },
  30 + });
  31 + }
  32 +
  33 + return () => {
  34 + _.each(handles, (handle) => handle.stop() );
  35 + };
  36 +};
  37 +
  38 +
  39 +const reduxTick = (props, onData) => {
  40 + onData(null, {
  41 + data: {}
  42 + });
  43 +};
  44 +
  45 +
  46 +export const AppNavigationController = composeAll(
  47 + composeWithTracker(meteorTick, Loading),
  48 + compose(reduxTick, Loading),
  49 +)(AppNavigation);
... ...
imports/client/views/org/admin/teachers/index.js
... ... @@ -0,0 +1,48 @@
  1 +// import { InviteSignupController } from '/imports/client/views/invite/signup/index'
  2 +import _ from 'lodash';
  3 +import {
  4 + composeWithTracker,
  5 + compose,
  6 + composeAll
  7 + } from 'react-komposer';
  8 +import { Loading } from '/imports/client/components/Loading';
  9 +
  10 +import { Orgs } from '/imports/collections/orgs/index';
  11 +import { Users } from '/imports/collections/users/index';
  12 +import { teachersView } from './teachersView';
  13 +
  14 +const meteorTick = (props, onData) => {
  15 +
  16 + const handles = [
  17 + Meteor.subscribe('users.current'),
  18 + Meteor.subscribe('orgs.current')
  19 + ];
  20 +
  21 + if(_.every(handles, (handle) => (handle.ready()) )) {
  22 + const user = Users.current();
  23 + const org = Orgs.current();
  24 + onData(null, {
  25 + data: {
  26 + user: user,
  27 + org: org
  28 + },
  29 + });
  30 + }
  31 +
  32 + return () => {
  33 + _.each(handles, (handle) => handle.stop() );
  34 + };
  35 +};
  36 +
  37 +
  38 +const reduxTick = (props, onData) => {
  39 + onData(null, {
  40 + data: {}
  41 + });
  42 +};
  43 +
  44 +
  45 +export const teachersViewController = composeAll(
  46 + composeWithTracker(meteorTick, Loading),
  47 + compose(reduxTick, Loading),
  48 +)(teachersView);
... ...
imports/client/views/org/admin/teachers/teachersView.js
... ... @@ -0,0 +1,33 @@
  1 +import _ from 'lodash';
  2 +import { Meteor } from 'meteor/meteor';
  3 +
  4 +import React, { Component } from 'react';
  5 +import { Link,browserHistory } from 'react-router';
  6 +import { FormGroup,
  7 + FormControl,Glyphicon,Button } from 'react-bootstrap';
  8 +
  9 +
  10 +export class teachersView extends Component {
  11 +
  12 + constructor(props) {
  13 + super(props);
  14 + this.state = {
  15 +
  16 + };
  17 + this.onUpdate = this.onUpdate.bind(this);
  18 + };
  19 +
  20 + onUpdate(key, value) {
  21 + this.setState({[key]: value});
  22 + };
  23 +
  24 + render() {
  25 + const {user, org} = this.props.data;
  26 + return (
  27 + <div className = "enterPane-box">
  28 +
  29 + </div>
  30 + );
  31 + };
  32 +
  33 +};
... ...