Commit d532f2f02b2cbf45d5c36d7121a722e42029640f
1 parent
bdd4abb610
Exists in
master
made changes in routes
Showing
28 changed files
with
1223 additions
and
1024 deletions
Show diff stats
imports/client/app/routes.js
1 | /* eslint-disable max-len */ | 1 | /* eslint-disable max-len */ |
2 | 2 | ||
3 | import React from 'react'; | 3 | import React from 'react'; |
4 | import { render } from 'react-dom'; | 4 | import { render } from 'react-dom'; |
5 | import { Router, Route, | 5 | import { Router, Route, |
6 | IndexRoute, browserHistory } from 'react-router'; | 6 | IndexRoute, browserHistory } from 'react-router'; |
7 | import { Meteor } from 'meteor/meteor'; | 7 | import { Meteor } from 'meteor/meteor'; |
8 | import { Users } from '/imports/collections/users/index'; | ||
8 | 9 | ||
9 | /** | 10 | /** |
10 | * General Components | 11 | * General Components |
11 | */ | 12 | */ |
12 | import NotFound from '/imports/client/views/org/NotFound'; | 13 | import NotFound from '/imports/client/views/org/NotFound'; |
13 | 14 | ||
14 | /** | 15 | /** |
15 | * Org Components | 16 | * Org Components |
16 | */ | 17 | */ |
18 | import { EnterModule } from '/imports/client/views/org/enter/module/index'; | ||
17 | 19 | ||
18 | import { App } from '/imports/client/layouts/OrgApp'; | 20 | |
19 | import { AppModule } from '/imports/client/views/org/app/module/Index'; | 21 | import { AdminAppModule } from '/imports/client/views/org/admin/app/module/Index'; |
22 | import { DashboardController } from '/imports/client/views/org/admin/dashboard/index'; | ||
20 | import { Orgs } from '/imports/collections/orgs/index'; | 23 | import { Orgs } from '/imports/collections/orgs/index'; |
21 | import { importCsvController } from '/imports/client/views/org/importCsv/index' | 24 | import { importCsvController } from '/imports/client/views/org/importCsv/index' |
22 | 25 | ||
23 | //admin | 26 | //admin |
24 | import { StudentDataController } from '/imports/client/views/org/admin/students/index' | 27 | import { StudentDataController } from '/imports/client/views/org/admin/students/index' |
25 | import { staffViewController } from '/imports/client/views/org/admin/staff/index' | 28 | import { staffViewController } from '/imports/client/views/org/admin/staff/index' |
26 | import { ParentViewController } from '/imports/client/views/org/admin/parents/index' | 29 | import { ParentViewController } from '/imports/client/views/org/admin/parents/index' |
27 | import { AdminSettingsController } from '/imports/client/views/org/admin/settings/index' | 30 | import { AdminSettingsController } from '/imports/client/views/org/admin/settings/index' |
28 | //students | 31 | //students |
29 | 32 | ||
30 | //teachers | 33 | //teachers |
31 | 34 | ||
32 | //parents | 35 | //parents |
33 | 36 | ||
34 | /** | 37 | /** |
35 | * Invalid Org Components | 38 | * Invalid Org Components |
36 | */ | 39 | */ |
37 | 40 | ||
38 | /** | 41 | /** |
39 | There are three types of routes | 42 | There are three types of routes |
40 | 1)getOrgRoutes: all the routes that should be present for a registered org | 43 | 1)getOrgRoutes: all the routes that should be present for a registered org |
41 | 2)getInvalidOrgRoute: all the routes where someone tries to enter a subdomain which hasn't been registered yet (404 mostly :D) | 44 | 2)getInvalidOrgRoute: all the routes where someone tries to enter a subdomain which hasn't been registered yet (404 mostly :D) |
42 | 3)getNonOrgRoutes: all routes linked to normal site, ie signing up a new org. CHeking out demo and everything internal | 45 | 3)getNonOrgRoutes: all routes linked to normal site, ie signing up a new org. CHeking out demo and everything internal |
43 | **/ | 46 | **/ |
44 | const getOrgRoutes = () => ( | 47 | const getOrgAdminRoutes = () => ( |
45 | <Router history={ browserHistory }> | 48 | <Router history={ browserHistory }> |
46 | <Route path="/" component={ App }> | 49 | <Route path="/" component={ AdminAppModule }> |
47 | <IndexRoute name="index" component={ AppModule } /> | 50 | <IndexRoute name="index" component={ DashboardController } /> |
48 | <Route name="import" path="/import" component={ importCsvController } /> | 51 | <Route name="import" path="/import" component={ importCsvController } /> |
49 | <Route name="student" path="/students" component={ StudentDataController } /> | 52 | <Route name="student" path="/students" component={ StudentDataController } /> |
50 | <Route name="staff" path="/staff" component={ staffViewController } /> | 53 | <Route name="staff" path="/staff" component={ staffViewController } /> |
51 | <Route name="parent" path="/parents" component={ ParentViewController } /> | 54 | <Route name="parent" path="/parents" component={ ParentViewController } /> |
52 | <Route name="settings" path="/settings" component={ AdminSettingsController } /> | 55 | <Route name="settings" path="/settings" component={ AdminSettingsController } /> |
53 | <Route path="*" component={ NotFound } /> | 56 | <Route path="*" component={ NotFound } /> |
54 | </Route> | 57 | </Route> |
55 | </Router> | 58 | </Router> |
56 | ) | 59 | ) |
57 | 60 | const getOrgNonLoggedInRoutes = () => ( | |
61 | <Router history={ browserHistory }> | ||
62 | <Route path="/" component={ EnterModule }> | ||
63 | <Route path="*" component={ NotFound } /> | ||
64 | </Route> | ||
65 | </Router> | ||
66 | ) | ||
58 | 67 | ||
59 | const getInvalidOrgRoute = () => ( | 68 | const getInvalidOrgRoute = () => ( |
60 | <Router history={ browserHistory }> | 69 | <Router history={ browserHistory }> |
61 | <Route path="/" component={ App }> | 70 | <Route path="/" component={ App }> |
62 | <IndexRoute name="index" component={ NotFound } /> | 71 | <IndexRoute name="index" component={ NotFound } /> |
63 | <Route path="*" component={ NotFound } /> | 72 | <Route path="*" component={ NotFound } /> |
64 | </Route> | 73 | </Route> |
65 | </Router> | 74 | </Router> |
66 | ) | 75 | ) |
67 | 76 | ||
68 | 77 | ||
69 | /** | 78 | /** |
70 | * NonOrg Components | 79 | * NonOrg Components |
71 | */ | 80 | */ |
72 | import Signup from '/imports/client/views/nonOrg/enter/SignupView'; | 81 | import Signup from '/imports/client/views/nonOrg/enter/SignupView'; |
73 | import { NonOrgApp } from '/imports/client/layouts/NonOrgApp'; | 82 | import { NonOrgApp } from '/imports/client/layouts/NonOrgApp'; |
74 | import {NonOrgAppModule} from '/imports/client/views/nonOrg/app/module/Index'; | 83 | import {NonOrgAppModule} from '/imports/client/views/nonOrg/app/module/Index'; |
75 | 84 | ||
76 | const getNonOrgRoutes = () => ( | 85 | const getNonOrgRoutes = () => ( |
77 | <Router history={ browserHistory }> | 86 | <Router history={ browserHistory }> |
78 | <Route path="/" component={ NonOrgApp }> | 87 | <Route path="/" component={ NonOrgApp }> |
79 | <IndexRoute name="index" component={ NonOrgAppModule } /> | 88 | <IndexRoute name="index" component={ NonOrgAppModule } /> |
80 | <Route name="signup" path="/signup" component={ Signup } /> | 89 | <Route name="signup" path="/signup" component={ Signup } /> |
81 | <Route path="*" component={ NotFound } /> | 90 | <Route path="*" component={ NotFound } /> |
82 | </Route> | 91 | </Route> |
83 | </Router> | 92 | </Router> |
84 | ) | 93 | ) |
85 | 94 | ||
86 | //Authenticate function to give access to users only | 95 | //Authenticate function to give access to users only |
87 | const authenticate = (nextState, replace) => { | 96 | const authenticate = (nextState, replace) => { |
88 | if (!Meteor.loggingIn() && !Meteor.userId()) { | 97 | if (!Meteor.loggingIn() && !Meteor.userId()) { |
89 | replace({ | 98 | replace({ |
90 | pathname: '/login', | 99 | pathname: '/login', |
91 | state: { nextPathname: nextState.location.pathname }, | 100 | state: { nextPathname: nextState.location.pathname }, |
92 | }); | 101 | }); |
93 | } | 102 | } |
94 | }; | 103 | }; |
95 | 104 | ||
96 | 105 | ||
97 | /** | 106 | /** |
98 | 107 | ||
99 | **/ | 108 | **/ |
100 | const detectOrg = () => { | 109 | const detectOrg = () => { |
101 | orgSlug = ""; | 110 | orgSlug = ""; |
102 | //www.app.ydapp.in | 111 | //www.app.ydapp.in |
103 | // | 112 | // |
104 | var hostnameArray = document.location.hostname.split( "." ); | 113 | var hostnameArray = document.location.hostname.split( "." ); |
105 | //['www','app', 'ydapp','in']; | 114 | //['www','app', 'ydapp','in']; |
106 | if(hostnameArray[0] !== "www"){ | 115 | if(hostnameArray[0] !== "www"){ |
107 | if((hostnameArray[1]==='localhost'||hostnameArray[1]==='ydapp')){ | 116 | if((hostnameArray[1]==='localhost'||hostnameArray[1]==='ydapp')){ |
108 | orgSlug = hostnameArray[0]; | 117 | orgSlug = hostnameArray[0]; |
109 | } | 118 | } |
110 | }else{ | 119 | }else{ |
111 | if((hostnameArray[2]==='localhost'||hostnameArray[2]==='ydapp')){ | 120 | if((hostnameArray[2]==='localhost'||hostnameArray[2]==='ydapp')){ |
112 | orgSlug = hostnameArray[1]; | 121 | orgSlug = hostnameArray[1]; |
113 | } | 122 | } |
114 | } | 123 | } |
115 | 124 | ||
116 | if(orgSlug!==""){ | 125 | if(orgSlug!==""){ |
117 | console.log(orgSlug); | 126 | console.log(orgSlug); |
118 | Meteor.call('checkExistingOrg', {slug:orgSlug}, function(err, res) { | 127 | Meteor.call('checkExistingOrg', {slug:orgSlug}, function(err, res) { |
119 | console.log(err); | 128 | console.log(err); |
120 | console.log(res); | 129 | console.log(res); |
130 | |||
121 | if(res){ | 131 | if(res){ |
122 | Session.set('orgId', res._id); | 132 | Session.set('orgId', res._id); |
123 | Session.set('orgSlug', orgSlug); | 133 | Session.set('orgSlug', orgSlug); |
124 | render(getOrgRoutes(),document.getElementById('app')); | 134 | if(Meteor.loggingIn() || Meteor.userId()){ |
135 | userRole = _.find(res.users, {userId: Meteor.user()._id}).role; | ||
136 | Session.set('userRole', userRole); | ||
137 | if(userRole=='ADMIN'){ | ||
138 | render(getOrgAdminRoutes(),document.getElementById('app')); | ||
139 | }else{ | ||
140 | |||
141 | } | ||
142 | }else{ | ||
143 | render(getOrgNonLoggedInRoutes(),document.getElementById('app')); | ||
144 | } | ||
125 | }else{ | 145 | }else{ |
126 | render(getInvalidOrgRoute(),document.getElementById('app')); | 146 | render(getInvalidOrgRoute(),document.getElementById('app')); |
127 | } | 147 | } |
128 | }); | 148 | }); |
129 | }else{ | 149 | }else{ |
130 | render(getNonOrgRoutes(),document.getElementById('app')); | 150 | render(getNonOrgRoutes(),document.getElementById('app')); |
131 | } | 151 | } |
132 | } | 152 | } |
133 | const checkSlug = (nextState, replace) => { | 153 | const checkSlug = (nextState, replace) => { |
134 | orgId = Session.get('orgId'); | 154 | orgId = Session.get('orgId'); |
135 | } | 155 | } |
136 | 156 | ||
137 | 157 | ||
138 | Meteor.startup(() => { | 158 | Meteor.startup(() => { |
139 | detectOrg(); | 159 | detectOrg(); |
140 | }); | 160 | }); |
141 | 161 |
imports/client/layouts/OrgApp.js
1 | import React, { Component } from 'react'; | File was deleted | |
2 | import { Grid } from 'react-bootstrap'; | ||
3 | import {AppNavigationController} from '/imports/client/views/org/app/module/navigation/index'; | ||
4 | /** | ||
5 | * user based redirection will take place here | ||
6 | */ | ||
7 | export class App extends Component { | ||
8 | constructor(props) { | ||
9 | super(props); | ||
10 | this.state = { | ||
11 | |||
12 | }; | ||
13 | }; | ||
14 | render(){ | ||
15 | return ( | ||
16 | <div className="app-main-layout"> | ||
17 | { this.props.children } | ||
18 | </div> | ||
19 | ) | ||
20 | } | ||
21 | } | ||
22 | 1 | import React, { Component } from 'react'; |
imports/client/views/org/admin/AdminLayout.js
1 | import _ from 'lodash'; | File was deleted | |
2 | import { Meteor } from 'meteor/meteor'; | ||
3 | import React, { Component } from 'react'; | ||
4 | import { Link } from 'react-router'; | ||
5 | import { Avatar } from '/imports/client/components/Avatar'; | ||
6 | import { Icon } from '/imports/client/components/Icon'; | ||
7 | import classNames from 'classnames'; | ||
8 | import { EnterModule } from '/imports/client/views/org/enter/module/index'; | ||
9 | import { AdminSidebar } from './Sidebar' | ||
10 | import { AdminBreadcrumb } from './Breadcrumb' | ||
11 | // import { VerifyModule } from '/imports/client/views/verify/module/index'; | ||
12 | import { Navbar,Modal, Nav, NavItem, | ||
13 | Glyphicon, Collapse, | ||
14 | NavbarToggler, NavbarBrand, | ||
15 | NavLink, DropdownItem, DropdownToggle, DropdownMenu, | ||
16 | NavDropdown, MenuItem, Breadcrumb } from 'react-bootstrap'; | ||
17 | import { VerifyModule } from '/imports/client/views/verify/module/index' | ||
18 | |||
19 | var Accordion = require('react-bootstrap').Accordion; | ||
20 | var Panel = require('react-bootstrap').Panel; | ||
21 | export class AdminAppLayout extends Component { | ||
22 | render() { | ||
23 | const {user, org} = this.props; | ||
24 | return ( | ||
25 | <div className = "appLayout-box"> | ||
26 | <div className="page-container"> | ||
27 | <div className="page-content"> | ||
28 | <AdminSidebar | ||
29 | user = {user} | ||
30 | org = {org} | ||
31 | /> | ||
32 | <div className="content-wrapper"> | ||
33 | <AdminBreadcrumb /> | ||
34 | <div className="content"> | ||
35 | <div className="row"> | ||
36 | <div className="col-lg-3 col-md-6"> | ||
37 | <div className="thumbnail"> | ||
38 | <Link to="/students" > | ||
39 | <div className="thumb thumb-rounded"> | ||
40 | <img src="assets/images/download2.png" alt="" /> | ||
41 | </div> | ||
42 | <div className="caption text-center"> | ||
43 | <h6 className="text-semibold no-margin">Students <small className="display-block">Click to view</small></h6> | ||
44 | </div> | ||
45 | </Link> | ||
46 | </div> | ||
47 | </div> | ||
48 | <div className="col-lg-3 col-md-6"> | ||
49 | <div className="thumbnail"> | ||
50 | <Link to="/staff" > | ||
51 | <div className="thumb thumb-rounded"> | ||
52 | <img src="assets/images/download3.png" alt=""/> | ||
53 | </div> | ||
54 | <div className="caption text-center"> | ||
55 | <h6 className="text-semibold no-margin">Teachers <small className="display-block">Click to view</small></h6> | ||
56 | </div> | ||
57 | </Link> | ||
58 | </div> | ||
59 | </div> | ||
60 | <div className="col-lg-3 col-md-6"> | ||
61 | <div className="thumbnail"> | ||
62 | <Link to="/parents" > | ||
63 | <div className="thumb thumb-rounded"> | ||
64 | <img src="assets/images/download3.png" alt=""/> | ||
65 | </div> | ||
66 | <div className="caption text-center"> | ||
67 | <h6 className="text-semibold no-margin">Parents <small className="display-block">Click to view</small></h6> | ||
68 | </div> | ||
69 | </Link> | ||
70 | </div> | ||
71 | </div> | ||
72 | </div> | ||
73 | </div> | ||
74 | </div> | ||
75 | </div> | ||
76 | </div> | ||
77 | </div> | ||
78 | ); | ||
79 | }; | ||
80 | |||
81 | }; | ||
82 | 1 | import _ from 'lodash'; |
imports/client/views/org/admin/app/AdminLayout.js
File was created | 1 | import _ from 'lodash'; | |
2 | import { Meteor } from 'meteor/meteor'; | ||
3 | import React, { Component } from 'react'; | ||
4 | import { Link } from 'react-router'; | ||
5 | import { Avatar } from '/imports/client/components/Avatar'; | ||
6 | import { Icon } from '/imports/client/components/Icon'; | ||
7 | import classNames from 'classnames'; | ||
8 | import { EnterModule } from '/imports/client/views/org/enter/module/index'; | ||
9 | import { AdminSidebar } from '../Sidebar' | ||
10 | import { AdminBreadcrumb } from '../Breadcrumb' | ||
11 | // import { VerifyModule } from '/imports/client/views/verify/module/index'; | ||
12 | import { Navbar,Modal, Nav, NavItem, | ||
13 | Glyphicon, Collapse, | ||
14 | NavbarToggler, NavbarBrand, | ||
15 | NavLink, DropdownItem, DropdownToggle, DropdownMenu, | ||
16 | NavDropdown, MenuItem, Breadcrumb } from 'react-bootstrap'; | ||
17 | import { VerifyModule } from '/imports/client/views/verify/module/index' | ||
18 | |||
19 | var Accordion = require('react-bootstrap').Accordion; | ||
20 | var Panel = require('react-bootstrap').Panel; | ||
21 | export class AdminAppLayout extends Component { | ||
22 | render() { | ||
23 | const {user, org} = this.props; | ||
24 | return ( | ||
25 | <div className="admin-app"> | ||
26 | <div className = "appLayout-box"> | ||
27 | <div className="page-container"> | ||
28 | <div className="page-content"> | ||
29 | <AdminSidebar | ||
30 | user = {user} | ||
31 | org = {org} | ||
32 | /> | ||
33 | <div className="content-wrapper"> | ||
34 | <AdminBreadcrumb /> | ||
35 | <div className="content"> | ||
36 | <div className="row"> | ||
37 | <div className="col-lg-3 col-md-6"> | ||
38 | <div className="thumbnail"> | ||
39 | <Link to="/students" > | ||
40 | <div className="thumb thumb-rounded"> | ||
41 | <img src="assets/images/download2.png" alt="" /> | ||
42 | </div> | ||
43 | <div className="caption text-center"> | ||
44 | <h6 className="text-semibold no-margin">Students <small className="display-block">Click to view</small></h6> | ||
45 | </div> | ||
46 | </Link> | ||
47 | </div> | ||
48 | </div> | ||
49 | <div className="col-lg-3 col-md-6"> | ||
50 | <div className="thumbnail"> | ||
51 | <Link to="/staff" > | ||
52 | <div className="thumb thumb-rounded"> | ||
53 | <img src="assets/images/download3.png" alt=""/> | ||
54 | </div> | ||
55 | <div className="caption text-center"> | ||
56 | <h6 className="text-semibold no-margin">Teachers <small className="display-block">Click to view</small></h6> | ||
57 | </div> | ||
58 | </Link> | ||
59 | </div> | ||
60 | </div> | ||
61 | <div className="col-lg-3 col-md-6"> | ||
62 | <div className="thumbnail"> | ||
63 | <Link to="/parents" > | ||
64 | <div className="thumb thumb-rounded"> | ||
65 | <img src="assets/images/download3.png" alt=""/> | ||
66 | </div> | ||
67 | <div className="caption text-center"> | ||
68 | <h6 className="text-semibold no-margin">Parents <small className="display-block">Click to view</small></h6> | ||
69 | </div> | ||
70 | </Link> | ||
71 | </div> | ||
72 | </div> | ||
73 | </div> | ||
74 | </div> | ||
75 | </div> | ||
76 | </div> | ||
77 | </div> | ||
78 | </div> | ||
79 | </div> | ||
80 | |||
81 | ); | ||
82 | }; | ||
83 | |||
84 | }; | ||
85 |
imports/client/views/org/admin/app/Index.js
File was created | 1 | // import { AppModule } from '/imports/client/views/app/module/index' | |
2 | import { | ||
3 | composeWithTracker, | ||
4 | compose, | ||
5 | composeAll | ||
6 | } from 'react-komposer'; | ||
7 | import { AdminAppLayout } from './AdminLayout'; | ||
8 | import { Loading } from '/imports/client/components/Loading'; | ||
9 | |||
10 | import { Users } from '/imports/collections/users/index'; | ||
11 | import { Orgs } from '/imports/collections/orgs/index'; | ||
12 | |||
13 | |||
14 | const meteorTick = (props, onData) => { | ||
15 | |||
16 | const handles = [ | ||
17 | Meteor.subscribe('users.current'), | ||
18 | Meteor.subscribe('orgs.current'), | ||
19 | Meteor.subscribe('users.forMyOrg'), | ||
20 | Meteor.subscribe('student.forMyOrg'), | ||
21 | ]; | ||
22 | |||
23 | if(_.every(handles, (handle) => (handle.ready()) )) { | ||
24 | const user = Users.current(); | ||
25 | const org = Orgs.current(); | ||
26 | onData(null, { | ||
27 | data: { | ||
28 | user: user, | ||
29 | org: org, | ||
30 | }, | ||
31 | }); | ||
32 | } | ||
33 | |||
34 | return () => { | ||
35 | _.each(handles, (handle) => handle.stop() ); | ||
36 | }; | ||
37 | }; | ||
38 | |||
39 | |||
40 | const reduxTick = (props, onData) => { | ||
41 | onData(null, { | ||
42 | location: props.location, | ||
43 | data: {} | ||
44 | }); | ||
45 | }; | ||
46 | |||
47 | |||
48 | export const AdminModule = composeAll( | ||
49 | composeWithTracker(meteorTick, Loading), | ||
50 | compose(reduxTick, Loading), | ||
51 | )(AdminAppLayout); | ||
52 |
imports/client/views/org/admin/app/module/AdminAppLayout.js
File was created | 1 | import _ from 'lodash'; | |
2 | import { Meteor } from 'meteor/meteor'; | ||
3 | import React, { Component } from 'react'; | ||
4 | import { Link } from 'react-router'; | ||
5 | import { Avatar } from '/imports/client/components/Avatar'; | ||
6 | import { Icon } from '/imports/client/components/Icon'; | ||
7 | import classNames from 'classnames'; | ||
8 | import { EnterModule } from '/imports/client/views/org/enter/module/index'; | ||
9 | import {AppNavigationController} from '/imports/client/views/org/admin/app/module/navigation/index'; | ||
10 | import { AdminSidebar } from '../../Sidebar' | ||
11 | import { AdminBreadcrumb } from '../../Breadcrumb' | ||
12 | // import { VerifyModule } from '/imports/client/views/verify/module/index'; | ||
13 | import { Navbar,Modal, Nav, NavItem, | ||
14 | Glyphicon, Collapse, | ||
15 | NavbarToggler, NavbarBrand, | ||
16 | NavLink, DropdownItem, DropdownToggle, DropdownMenu, | ||
17 | NavDropdown, MenuItem, Breadcrumb, Grid } | ||
18 | from 'react-bootstrap'; | ||
19 | import { VerifyModule } from '/imports/client/views/verify/module/index' | ||
20 | import { AdminModule } from '/imports/client/views/org/admin/app/Index' | ||
21 | |||
22 | var Accordion = require('react-bootstrap').Accordion; | ||
23 | var Panel = require('react-bootstrap').Panel; | ||
24 | export class AdminAppLayout extends Component { | ||
25 | |||
26 | render() { | ||
27 | const {user, org} = this.props.data; | ||
28 | if(!user.isEmailVerified()) { | ||
29 | return ( | ||
30 | <VerifyModule | ||
31 | pane = {this.props.location.query.verify} | ||
32 | location = {this.props.location} | ||
33 | /> | ||
34 | ); | ||
35 | }else{ | ||
36 | return ( | ||
37 | <div className="admin-app"> | ||
38 | <AppNavigationController /> | ||
39 | <div className = "appLayout-box"> | ||
40 | <div className="page-container"> | ||
41 | <div className="page-content"> | ||
42 | <AdminSidebar | ||
43 | user = {user} | ||
44 | org = {org} | ||
45 | /> | ||
46 | <div className="content-wrapper"> | ||
47 | <AdminBreadcrumb /> | ||
48 | <div className="content"> | ||
49 | { this.props.children } | ||
50 | </div> | ||
51 | </div> | ||
52 | </div> | ||
53 | </div> | ||
54 | </div> | ||
55 | </div> | ||
56 | ) | ||
57 | return( | ||
58 | <AdminModule | ||
59 | user = {user} | ||
60 | org = {org} | ||
61 | /> | ||
62 | ); | ||
63 | } | ||
64 | }; | ||
65 | |||
66 | }; | ||
67 |
imports/client/views/org/admin/app/module/Index.js
File was created | 1 | // import { AppModule } from '/imports/client/views/app/module/index' | |
2 | import { | ||
3 | composeWithTracker, | ||
4 | compose, | ||
5 | composeAll | ||
6 | } from 'react-komposer'; | ||
7 | import { AdminAppLayout } from './AdminAppLayout'; | ||
8 | import { Loading } from '/imports/client/components/Loading'; | ||
9 | |||
10 | import { Users } from '/imports/collections/users/index'; | ||
11 | import { Orgs } from '/imports/collections/orgs/index'; | ||
12 | |||
13 | |||
14 | const meteorTick = (props, onData) => { | ||
15 | |||
16 | const handles = [ | ||
17 | Meteor.subscribe('users.current'), | ||
18 | Meteor.subscribe('orgs.current'), | ||
19 | Meteor.subscribe('users.forMyOrg'), | ||
20 | Meteor.subscribe('student.forMyOrg'), | ||
21 | ]; | ||
22 | |||
23 | if(_.every(handles, (handle) => (handle.ready()) )) { | ||
24 | const user = Users.current(); | ||
25 | const org = Orgs.current(); | ||
26 | onData(null, { | ||
27 | data: { | ||
28 | user: user, | ||
29 | org: org, | ||
30 | }, | ||
31 | }); | ||
32 | } | ||
33 | |||
34 | return () => { | ||
35 | _.each(handles, (handle) => handle.stop() ); | ||
36 | }; | ||
37 | }; | ||
38 | |||
39 | |||
40 | const reduxTick = (props, onData) => { | ||
41 | onData(null, { | ||
42 | location: props.location, | ||
43 | data: {} | ||
44 | }); | ||
45 | }; | ||
46 | |||
47 | |||
48 | export const AdminAppModule = composeAll( | ||
49 | composeWithTracker(meteorTick, Loading), | ||
50 | compose(reduxTick, Loading), | ||
51 | )(AdminAppLayout); | ||
52 |
imports/client/views/org/admin/app/module/navigation/AppNavigation.js
File was created | 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 { | ||
13 | |||
14 | constructor(props) { | ||
15 | super(props); | ||
16 | this.state = { | ||
17 | |||
18 | }; | ||
19 | }; | ||
20 | |||
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 | } | ||
48 | |||
49 | return ( | ||
50 | <div></div> | ||
51 | ); | ||
52 | }; | ||
53 | |||
54 | }; | ||
55 |
imports/client/views/org/admin/app/module/navigation/AuthenticatedNavigation.js
File was created | 1 | import React, { Component } from 'react'; | |
2 | import { browserHistory } from 'react-router'; | ||
3 | import { LinkContainer } from 'react-router-bootstrap'; | ||
4 | import { logout } from '/imports/client/app/utils/loginMethods'; | ||
5 | import { Navbar,Modal, Nav, NavItem, | ||
6 | Glyphicon, Collapse, | ||
7 | NavbarToggler, NavbarBrand, | ||
8 | NavLink, DropdownItem, DropdownToggle, DropdownMenu, | ||
9 | NavDropdown, MenuItem } from 'react-bootstrap'; | ||
10 | import { Meteor } from 'meteor/meteor'; | ||
11 | import $ from 'jquery'; | ||
12 | |||
13 | |||
14 | const handleLogout = () => Meteor.logout(() => browserHistory.push('/login')); | ||
15 | |||
16 | export class AuthenticatedNavigation extends Component { | ||
17 | constructor(props) { | ||
18 | super(props); | ||
19 | this.toggle = this.toggle.bind(this); | ||
20 | this.changeBodyClass = this.changeBodyClass.bind(this); | ||
21 | this.state = { | ||
22 | dropdownOpen: false, | ||
23 | burgerMenu: false | ||
24 | }; | ||
25 | } | ||
26 | toggle() { | ||
27 | this.setState({ | ||
28 | dropdownOpen: !this.state.dropdownOpen | ||
29 | }); | ||
30 | } | ||
31 | changeBodyClass(){ | ||
32 | if(this.state.burgerMenu){ | ||
33 | $('body').addClass('sidebar-xs'); | ||
34 | this.setState({burgerMenu: false}); | ||
35 | }else{ | ||
36 | $('body').removeClass('sidebar-xs'); | ||
37 | this.setState({burgerMenu: true}); | ||
38 | } | ||
39 | } | ||
40 | render(){ | ||
41 | const {user, org} = this.props.data; | ||
42 | return( | ||
43 | <Navbar inverse collapseOnSelect className="bg-crimson"> | ||
44 | <Navbar.Header> | ||
45 | <Navbar.Brand> | ||
46 | <a href="#"> | ||
47 | <Glyphicon glyph="link" /> | ||
48 | YoungDesk | ||
49 | </a> | ||
50 | </Navbar.Brand> | ||
51 | <ul className="nav navbar-nav visible-xs-block"> | ||
52 | <li><a href="#"><i className="icon-tree5"/></a></li> | ||
53 | <li><a className="sidebar-mobile-main-toggle"><i className="icon-paragraph-justify3"/></a></li> | ||
54 | </ul> | ||
55 | <Navbar.Toggle /> | ||
56 | </Navbar.Header> | ||
57 | <Navbar.Collapse id="navbar-mobile"> | ||
58 | <ul className="nav navbar-nav"> | ||
59 | <NavItem eventKey={1} href="#" className="sidebar-control sidebar-main-toggle hidden-xs"> | ||
60 | <i | ||
61 | className="icon-paragraph-justify3 burgerMenu" | ||
62 | onClick = {this.changeBodyClass} | ||
63 | /> | ||
64 | </NavItem> | ||
65 | |||
66 | <NavDropdown title="Dropdown" id="update"> | ||
67 | <div className="dropdown-content"> | ||
68 | <div className="dropdown-content-heading"> | ||
69 | Git updates | ||
70 | <ul className="icons-list"> | ||
71 | <li><a href="#"><i className="icon-sync"></i></a></li> | ||
72 | </ul> | ||
73 | |||
74 | </div> | ||
75 | <ul className="media-list dropdown-content-body width-350"> | ||
76 | <li className="media"> | ||
77 | <div className="media-left"> | ||
78 | <a href="#" className="btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-pull-request"></i></a> | ||
79 | </div> | ||
80 | |||
81 | <div className="media-body"> | ||
82 | Drop the IE <a href="#">specific hacks</a> for temporal inputs | ||
83 | <div className="media-annotation">4 minutes ago</div> | ||
84 | </div> | ||
85 | </li> | ||
86 | |||
87 | <li className="media"> | ||
88 | <div className="media-left"> | ||
89 | <a href="#" className="btn border-warning text-warning btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-commit"></i></a> | ||
90 | </div> | ||
91 | |||
92 | <div className="media-body"> | ||
93 | Add full font overrides for popovers and tooltips | ||
94 | <div className="media-annotation">36 minutes ago</div> | ||
95 | </div> | ||
96 | </li> | ||
97 | |||
98 | <li className="media"> | ||
99 | <div className="media-left"> | ||
100 | <a href="#" className="btn border-info text-info btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-branch"></i></a> | ||
101 | </div> | ||
102 | |||
103 | <div className="media-body"> | ||
104 | <a href="#">Chris Arney</a> created a new <span className="text-semibold">Design</span> branch | ||
105 | <div className="media-annotation">2 hours ago</div> | ||
106 | </div> | ||
107 | </li> | ||
108 | |||
109 | <li className="media"> | ||
110 | <div className="media-left"> | ||
111 | <a href="#" className="btn border-success text-success btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-merge"></i></a> | ||
112 | </div> | ||
113 | |||
114 | <div className="media-body"> | ||
115 | <a href="#">Eugene Kopyov</a> merged <span className="text-semibold">Master</span> and <span className="text-semibold">Dev</span> branches | ||
116 | <div className="media-annotation">Dec 18, 18:36</div> | ||
117 | </div> | ||
118 | </li> | ||
119 | |||
120 | <li className="media"> | ||
121 | <div className="media-left"> | ||
122 | <a href="#" className="btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-pull-request"></i></a> | ||
123 | </div> | ||
124 | |||
125 | <div className="media-body"> | ||
126 | Have Carousel ignore keyboard events | ||
127 | <div className="media-annotation">Dec 12, 05:46</div> | ||
128 | </div> | ||
129 | </li> | ||
130 | </ul> | ||
131 | <div className="dropdown-content-footer"> | ||
132 | <a href="#" data-popup="tooltip" title="All activity"><i className="icon-menu display-block"></i></a> | ||
133 | </div> | ||
134 | </div> | ||
135 | </NavDropdown> | ||
136 | </ul> | ||
137 | <div className="navbar-right"> | ||
138 | <p className="navbar-text">Hello {user.getFullName()}</p> | ||
139 | <p className="navbar-text" | ||
140 | onClick = {() => logout()} | ||
141 | > | ||
142 | <span className="label logout">logout</span> | ||
143 | </p> | ||
144 | <Nav> | ||
145 | <NavDropdown title="Activity" id="activity"> | ||
146 | <div className="dropdown-content"> | ||
147 | <div className="dropdown-content-heading"> | ||
148 | Activity | ||
149 | <ul className="icons-list"> | ||
150 | <li><a href="#"><i className="icon-menu7"></i></a></li> | ||
151 | </ul> | ||
152 | </div> | ||
153 | <ul className="media-list dropdown-content-body width-350"> | ||
154 | <li className="media"> | ||
155 | <div className="media-left"> | ||
156 | <a href="#" className="btn bg-success-400 btn-rounded btn-icon btn-xs"><i className="icon-mention"></i></a> | ||
157 | </div> | ||
158 | |||
159 | <div className="media-body"> | ||
160 | <a href="#">Taylor Swift</a> mentioned you in a post "Angular JS. Tips and tricks" | ||
161 | <div className="media-annotation">4 minutes ago</div> | ||
162 | </div> | ||
163 | </li> | ||
164 | <li className="media"> | ||
165 | <div className="media-left"> | ||
166 | <a href="#" className="btn bg-pink-400 btn-rounded btn-icon btn-xs"><i className="icon-paperplane"></i></a> | ||
167 | </div> | ||
168 | |||
169 | <div className="media-body"> | ||
170 | Special offers have been sent to subscribed users by <a href="#">Donna Gordon</a> | ||
171 | <div className="media-annotation">36 minutes ago</div> | ||
172 | </div> | ||
173 | </li> | ||
174 | <li className="media"> | ||
175 | <div className="media-left"> | ||
176 | <a href="#" className="btn bg-blue btn-rounded btn-icon btn-xs"><i className="icon-plus3"></i></a> | ||
177 | </div> | ||
178 | |||
179 | <div className="media-body"> | ||
180 | <a href="#">Chris Arney</a> created a new <span className="text-semibold">Design</span> branch in <span className="text-semibold">Limitless</span> repository | ||
181 | <div className="media-annotation">2 hours ago</div> | ||
182 | </div> | ||
183 | </li> | ||
184 | |||
185 | <li className="media"> | ||
186 | <div className="media-left"> | ||
187 | <a href="#" className="btn bg-purple-300 btn-rounded btn-icon btn-xs"><i className="icon-truck"></i></a> | ||
188 | </div> | ||
189 | |||
190 | <div className="media-body"> | ||
191 | Shipping cost to the Netherlands has been reduced, database updated | ||
192 | <div className="media-annotation">Feb 8, 11:30</div> | ||
193 | </div> | ||
194 | </li> | ||
195 | |||
196 | <li className="media"> | ||
197 | <div className="media-left"> | ||
198 | <a href="#" className="btn bg-warning-400 btn-rounded btn-icon btn-xs"><i className="icon-bubble8"></i></a> | ||
199 | </div> | ||
200 | |||
201 | <div className="media-body"> | ||
202 | New review received on <a href="#">Server side integration</a> services | ||
203 | <div className="media-annotation">Feb 2, 10:20</div> | ||
204 | </div> | ||
205 | </li> | ||
206 | |||
207 | <li className="media"> | ||
208 | <div className="media-left"> | ||
209 | <a href="#" className="btn bg-teal-400 btn-rounded btn-icon btn-xs"><i className="icon-spinner11"></i></a> | ||
210 | </div> | ||
211 | |||
212 | <div className="media-body"> | ||
213 | <strong>January, 2016</strong> - 1320 new users, 3284 orders, $49,390 revenue | ||
214 | <div className="media-annotation">Feb 1, 05:46</div> | ||
215 | </div> | ||
216 | </li> | ||
217 | </ul> | ||
218 | </div> | ||
219 | </NavDropdown> | ||
220 | <NavDropdown title="Messages" id="messages"> | ||
221 | <div className="dropdown-content width-350"> | ||
222 | <div className="dropdown-content-heading"> | ||
223 | Messages | ||
224 | <ul className="icons-list"> | ||
225 | <li><a href="#"><i className="icon-compose"></i></a></li> | ||
226 | </ul> | ||
227 | </div> | ||
228 | |||
229 | <ul className="media-list dropdown-content-body"> | ||
230 | <li className="media"> | ||
231 | <div className="media-left"> | ||
232 | |||
233 | <span className="badge bg-danger-400 media-badge">5</span> | ||
234 | </div> | ||
235 | |||
236 | <div className="media-body"> | ||
237 | <a href="#" className="media-heading"> | ||
238 | <span className="text-semibold">James Alexander</span> | ||
239 | <span className="media-annotation pull-right">04:58</span> | ||
240 | </a> | ||
241 | |||
242 | <span className="text-muted">who knows, maybe that would be the best thing for me...</span> | ||
243 | </div> | ||
244 | </li> | ||
245 | |||
246 | <li className="media"> | ||
247 | <div className="media-left"> | ||
248 | |||
249 | <span className="badge bg-danger-400 media-badge">4</span> | ||
250 | </div> | ||
251 | |||
252 | <div className="media-body"> | ||
253 | <a href="#" className="media-heading"> | ||
254 | <span className="text-semibold">Margo Baker</span> | ||
255 | <span className="media-annotation pull-right">12:16</span> | ||
256 | </a> | ||
257 | |||
258 | <span className="text-muted">That was something he was unable to do because...</span> | ||
259 | </div> | ||
260 | </li> | ||
261 | |||
262 | <li className="media"> | ||
263 | <div className="media-left"></div> | ||
264 | <div className="media-body"> | ||
265 | <a href="#" className="media-heading"> | ||
266 | <span className="text-semibold">Jeremy Victorino</span> | ||
267 | <span className="media-annotation pull-right">22:48</span> | ||
268 | </a> | ||
269 | |||
270 | <span className="text-muted">But that would be extremely strained and suspicious...</span> | ||
271 | </div> | ||
272 | </li> | ||
273 | |||
274 | <li className="media"> | ||
275 | <div className="media-left"></div> | ||
276 | <div className="media-body"> | ||
277 | <a href="#" className="media-heading"> | ||
278 | <span className="text-semibold">Beatrix Diaz</span> | ||
279 | <span className="media-annotation pull-right">Tue</span> | ||
280 | </a> | ||
281 | |||
282 | <span className="text-muted">What a strenuous career it is that I have chosen...</span> | ||
283 | </div> | ||
284 | </li> | ||
285 | |||
286 | <li className="media"> | ||
287 | <div className="media-left"> | ||
288 | |||
289 | </div> | ||
290 | <div className="media-body"> | ||
291 | <a href="#" className="media-heading"> | ||
292 | <span className="text-semibold">Richard Vango</span> | ||
293 | <span className="media-annotation pull-right">Mon</span> | ||
294 | </a> | ||
295 | |||
296 | <span className="text-muted">Other travelling salesmen live a life of luxury...</span> | ||
297 | </div> | ||
298 | </li> | ||
299 | </ul> | ||
300 | |||
301 | <div className="dropdown-content-footer"> | ||
302 | <a href="#" data-popup="tooltip" title="All messages"><i className="icon-menu display-block"></i></a> | ||
303 | </div> | ||
304 | </div> | ||
305 | </NavDropdown> | ||
306 | </Nav> | ||
307 | </div> | ||
308 | </Navbar.Collapse> | ||
309 | </Navbar> | ||
310 | ); | ||
311 | } | ||
312 | } | ||
313 |
imports/client/views/org/admin/app/module/navigation/AuthenticatedNavigation0.js
File was created | 1 | import React, { Component } from 'react'; | |
2 | import { browserHistory } from 'react-router'; | ||
3 | import { LinkContainer } from 'react-router-bootstrap'; | ||
4 | import { Nav, NavItem, | ||
5 | NavDropdown, MenuItem } from 'react-bootstrap'; | ||
6 | import { Meteor } from 'meteor/meteor'; | ||
7 | |||
8 | const handleLogout = () => Meteor.logout(() => browserHistory.push('/login')); | ||
9 | |||
10 | export class AuthenticatedNavigation extends Component { | ||
11 | constructor(props) { | ||
12 | super(props); | ||
13 | this.state = { | ||
14 | |||
15 | }; | ||
16 | }; | ||
17 | render(){ | ||
18 | const {user} = this.props.data; | ||
19 | return( | ||
20 | <div> | ||
21 | <div className="navbar navbar-inverse bg-crimson"> | ||
22 | <div className="navbar-header"> | ||
23 | <a className="navbar-brand" href="index.html"><span className="glyphicon glyphicon-link"></span> | ||
24 | <span> YOUNGDESK </span> | ||
25 | </a> | ||
26 | |||
27 | <ul className="nav navbar-nav visible-xs-block"> | ||
28 | <li><a data-toggle="collapse" data-target="#navbar-mobile"><i className="icon-tree5"></i></a></li> | ||
29 | <li><a className="sidebar-mobile-main-toggle"><i className="icon-paragraph-justify3"></i></a></li> | ||
30 | </ul> | ||
31 | </div> | ||
32 | |||
33 | <div className="navbar-collapse collapse" id="navbar-mobile"> | ||
34 | <ul className="nav navbar-nav"> | ||
35 | <li><a className="sidebar-control sidebar-main-toggle hidden-xs"><i className="icon-paragraph-justify3"></i></a></li> | ||
36 | |||
37 | <li className="dropdown"> | ||
38 | <a href="#" className="dropdown-toggle" data-toggle="dropdown"> | ||
39 | <i className="icon-puzzle3"></i> | ||
40 | <span className="visible-xs-inline-block position-right">Git updates</span> | ||
41 | <span className="status-mark border-orange-400"></span> | ||
42 | </a> | ||
43 | |||
44 | <div className="dropdown-menu dropdown-content"> | ||
45 | <div className="dropdown-content-heading"> | ||
46 | Git updates | ||
47 | <ul className="icons-list"> | ||
48 | <li><a href="#"><i className="icon-sync"></i></a></li> | ||
49 | </ul> | ||
50 | </div> | ||
51 | |||
52 | <ul className="media-list dropdown-content-body width-350"> | ||
53 | <li className="media"> | ||
54 | <div className="media-left"> | ||
55 | <a href="#" className="btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-pull-request"></i></a> | ||
56 | </div> | ||
57 | |||
58 | <div className="media-body"> | ||
59 | Drop the IE <a href="#">specific hacks</a> for temporal inputs | ||
60 | <div className="media-annotation">4 minutes ago</div> | ||
61 | </div> | ||
62 | </li> | ||
63 | |||
64 | <li className="media"> | ||
65 | <div className="media-left"> | ||
66 | <a href="#" className="btn border-warning text-warning btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-commit"></i></a> | ||
67 | </div> | ||
68 | |||
69 | <div className="media-body"> | ||
70 | Add full font overrides for popovers and tooltips | ||
71 | <div className="media-annotation">36 minutes ago</div> | ||
72 | </div> | ||
73 | </li> | ||
74 | |||
75 | <li className="media"> | ||
76 | <div className="media-left"> | ||
77 | <a href="#" className="btn border-info text-info btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-branch"></i></a> | ||
78 | </div> | ||
79 | |||
80 | <div className="media-body"> | ||
81 | <a href="#">Chris Arney</a> created a new <span className="text-semibold">Design</span> branch | ||
82 | <div className="media-annotation">2 hours ago</div> | ||
83 | </div> | ||
84 | </li> | ||
85 | |||
86 | <li className="media"> | ||
87 | <div className="media-left"> | ||
88 | <a href="#" className="btn border-success text-success btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-merge"></i></a> | ||
89 | </div> | ||
90 | |||
91 | <div className="media-body"> | ||
92 | <a href="#">Eugene Kopyov</a> merged <span className="text-semibold">Master</span> and <span className="text-semibold">Dev</span> branches | ||
93 | <div className="media-annotation">Dec 18, 18:36</div> | ||
94 | </div> | ||
95 | </li> | ||
96 | |||
97 | <li className="media"> | ||
98 | <div className="media-left"> | ||
99 | <a href="#" className="btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-pull-request"></i></a> | ||
100 | </div> | ||
101 | |||
102 | <div className="media-body"> | ||
103 | Have Carousel ignore keyboard events | ||
104 | <div className="media-annotation">Dec 12, 05:46</div> | ||
105 | </div> | ||
106 | </li> | ||
107 | </ul> | ||
108 | |||
109 | <div className="dropdown-content-footer"> | ||
110 | <a href="#" data-popup="tooltip" title="All activity"><i className="icon-menu display-block"></i></a> | ||
111 | </div> | ||
112 | </div> | ||
113 | </li> | ||
114 | </ul> | ||
115 | |||
116 | <div className="navbar-right"> | ||
117 | <p className="navbar-text">Hello {`${user.firstName} ${user.lastName}`}!</p> | ||
118 | <p className="navbar-text"><span className="label bg-success-400">Online</span></p> | ||
119 | |||
120 | <ul className="nav navbar-nav"> | ||
121 | <li className="dropdown"> | ||
122 | <a href="#" className="dropdown-toggle" data-toggle="dropdown"> | ||
123 | <i className="icon-bell2"></i> | ||
124 | <span className="visible-xs-inline-block position-right">Activity</span> | ||
125 | <span className="status-mark border-orange-400"></span> | ||
126 | </a> | ||
127 | |||
128 | <div className="dropdown-menu dropdown-content"> | ||
129 | <div className="dropdown-content-heading"> | ||
130 | Activity | ||
131 | <ul className="icons-list"> | ||
132 | <li><a href="#"><i className="icon-menu7"></i></a></li> | ||
133 | </ul> | ||
134 | </div> | ||
135 | |||
136 | <ul className="media-list dropdown-content-body width-350"> | ||
137 | <li className="media"> | ||
138 | <div className="media-left"> | ||
139 | <a href="#" className="btn bg-success-400 btn-rounded btn-icon btn-xs"><i className="icon-mention"></i></a> | ||
140 | </div> | ||
141 | |||
142 | <div className="media-body"> | ||
143 | <a href="#">Taylor Swift</a> mentioned you in a post "Angular JS. Tips and tricks" | ||
144 | <div className="media-annotation">4 minutes ago</div> | ||
145 | </div> | ||
146 | </li> | ||
147 | |||
148 | <li className="media"> | ||
149 | <div className="media-left"> | ||
150 | <a href="#" className="btn bg-pink-400 btn-rounded btn-icon btn-xs"><i className="icon-paperplane"></i></a> | ||
151 | </div> | ||
152 | |||
153 | <div className="media-body"> | ||
154 | Special offers have been sent to subscribed users by <a href="#">Donna Gordon</a> | ||
155 | <div className="media-annotation">36 minutes ago</div> | ||
156 | </div> | ||
157 | </li> | ||
158 | |||
159 | <li className="media"> | ||
160 | <div className="media-left"> | ||
161 | <a href="#" className="btn bg-blue btn-rounded btn-icon btn-xs"><i className="icon-plus3"></i></a> | ||
162 | </div> | ||
163 | |||
164 | <div className="media-body"> | ||
165 | <a href="#">Chris Arney</a> created a new <span className="text-semibold">Design</span> branch in <span className="text-semibold">Limitless</span> repository | ||
166 | <div className="media-annotation">2 hours ago</div> | ||
167 | </div> | ||
168 | </li> | ||
169 | |||
170 | <li className="media"> | ||
171 | <div className="media-left"> | ||
172 | <a href="#" className="btn bg-purple-300 btn-rounded btn-icon btn-xs"><i className="icon-truck"></i></a> | ||
173 | </div> | ||
174 | |||
175 | <div className="media-body"> | ||
176 | Shipping cost to the Netherlands has been reduced, database updated | ||
177 | <div className="media-annotation">Feb 8, 11:30</div> | ||
178 | </div> | ||
179 | </li> | ||
180 | |||
181 | <li className="media"> | ||
182 | <div className="media-left"> | ||
183 | <a href="#" className="btn bg-warning-400 btn-rounded btn-icon btn-xs"><i className="icon-bubble8"></i></a> | ||
184 | </div> | ||
185 | |||
186 | <div className="media-body"> | ||
187 | New review received on <a href="#">Server side integration</a> services | ||
188 | <div className="media-annotation">Feb 2, 10:20</div> | ||
189 | </div> | ||
190 | </li> | ||
191 | |||
192 | <li className="media"> | ||
193 | <div className="media-left"> | ||
194 | <a href="#" className="btn bg-teal-400 btn-rounded btn-icon btn-xs"><i className="icon-spinner11"></i></a> | ||
195 | </div> | ||
196 | |||
197 | <div className="media-body"> | ||
198 | <strong>January, 2016</strong> - 1320 new users, 3284 orders, $49,390 revenue | ||
199 | <div className="media-annotation">Feb 1, 05:46</div> | ||
200 | </div> | ||
201 | </li> | ||
202 | </ul> | ||
203 | </div> | ||
204 | </li> | ||
205 | |||
206 | <li className="dropdown"> | ||
207 | <a href="#" className="dropdown-toggle" data-toggle="dropdown"> | ||
208 | <i className="icon-bubble8"></i> | ||
209 | <span className="visible-xs-inline-block position-right">Messages</span> | ||
210 | <span className="status-mark border-orange-400"></span> | ||
211 | </a> | ||
212 | |||
213 | <div className="dropdown-menu dropdown-content width-350"> | ||
214 | <div className="dropdown-content-heading"> | ||
215 | Messages | ||
216 | <ul className="icons-list"> | ||
217 | <li><a href="#"><i className="icon-compose"></i></a></li> | ||
218 | </ul> | ||
219 | </div> | ||
220 | |||
221 | <ul className="media-list dropdown-content-body"> | ||
222 | <li className="media"> | ||
223 | <div className="media-left"> | ||
224 | <img src="assets/images/placeholder.jpg" className="img-circle img-sm" alt="" /> | ||
225 | <span className="badge bg-danger-400 media-badge">5</span> | ||
226 | </div> | ||
227 | |||
228 | <div className="media-body"> | ||
229 | <a href="#" className="media-heading"> | ||
230 | <span className="text-semibold">James Alexander</span> | ||
231 | <span className="media-annotation pull-right">04:58</span> | ||
232 | </a> | ||
233 | |||
234 | <span className="text-muted">who knows, maybe that would be the best thing for me...</span> | ||
235 | </div> | ||
236 | </li> | ||
237 | |||
238 | <li className="media"> | ||
239 | <div className="media-left"> | ||
240 | <img src="assets/images/placeholder.jpg" className="img-circle img-sm" alt="" /> | ||
241 | <span className="badge bg-danger-400 media-badge">4</span> | ||
242 | </div> | ||
243 | |||
244 | <div className="media-body"> | ||
245 | <a href="#" className="media-heading"> | ||
246 | <span className="text-semibold">Margo Baker</span> | ||
247 | <span className="media-annotation pull-right">12:16</span> | ||
248 | </a> | ||
249 | |||
250 | <span className="text-muted">That was something he was unable to do because...</span> | ||
251 | </div> | ||
252 | </li> | ||
253 | |||
254 | <li className="media"> | ||
255 | <div className="media-left"><img src="assets/images/placeholder.jpg" className="img-circle img-sm" alt="" /></div> | ||
256 | <div className="media-body"> | ||
257 | <a href="#" className="media-heading"> | ||
258 | <span className="text-semibold">Jeremy Victorino</span> | ||
259 | <span className="media-annotation pull-right">22:48</span> | ||
260 | </a> | ||
261 | |||
262 | <span className="text-muted">But that would be extremely strained and suspicious...</span> | ||
263 | </div> | ||
264 | </li> | ||
265 | |||
266 | <li className="media"> | ||
267 | <div className="media-left"><img src="assets/images/placeholder.jpg" className="img-circle img-sm" alt="" /></div> | ||
268 | <div className="media-body"> | ||
269 | <a href="#" className="media-heading"> | ||
270 | <span className="text-semibold">Beatrix Diaz</span> | ||
271 | <span className="media-annotation pull-right">Tue</span> | ||
272 | </a> | ||
273 | |||
274 | <span className="text-muted">What a strenuous career it is that I have chosen...</span> | ||
275 | </div> | ||
276 | </li> | ||
277 | |||
278 | <li className="media"> | ||
279 | <div className="media-left"><img src="assets/images/placeholder.jpg" className="img-circle img-sm" alt="" /></div> | ||
280 | <div className="media-body"> | ||
281 | <a href="#" className="media-heading"> | ||
282 | <span className="text-semibold">Richard Vango</span> | ||
283 | <span className="media-annotation pull-right">Mon</span> | ||
284 | </a> | ||
285 | |||
286 | <span className="text-muted">Other travelling salesmen live a life of luxury...</span> | ||
287 | </div> | ||
288 | </li> | ||
289 | </ul> | ||
290 | |||
291 | <div className="dropdown-content-footer"> | ||
292 | <a href="#" data-popup="tooltip" title="All messages"><i className="icon-menu display-block"></i></a> | ||
293 | </div> | ||
294 | </div> | ||
295 | </li> | ||
296 | </ul> | ||
297 | </div> | ||
298 | </div> | ||
299 | </div> | ||
300 | </div> | ||
301 | ); | ||
302 | } | ||
303 | } | ||
304 |
imports/client/views/org/admin/app/module/navigation/Loading.js
File was created | 1 | import React from 'react'; | |
2 | |||
3 | const Loading = () => ( | ||
4 | <svg | ||
5 | version="1.1" | ||
6 | className="Loading" | ||
7 | xmlns="http://www.w3.org/2000/svg" | ||
8 | x="0px" | ||
9 | y="0px" | ||
10 | width="40px" | ||
11 | height="40px" | ||
12 | viewBox="0 0 40 40" | ||
13 | enableBackground="new 0 0 40 40"> | ||
14 | <path | ||
15 | opacity="1.0" | ||
16 | fill="#eee" | ||
17 | d="M20.201,5.169c-8.254,0-14.946,6.692-14.946,14.946c0,8.255,6.692,14.946, | ||
18 | 14.946,14.946s14.946-6.691,14.946-14.946C35.146,11.861,28.455,5.169,20.201, | ||
19 | 5.169z M20.201,31.749c-6.425,0-11.634-5.208-11.634-11.634c0-6.425, | ||
20 | 5.209-11.634,11.634-11.634c6.425,0,11.633,5.209,11.633,11.634C31.834, | ||
21 | 26.541,26.626,31.749,20.201,31.749z"/> | ||
22 | <path | ||
23 | fill="#da5347" | ||
24 | d="M26.013,10.047l1.654-2.866c-2.198-1.272-4.743-2.012-7.466-2.012h0v3.312h0 | ||
25 | C22.32,8.481,24.301,9.057,26.013,10.047z"> | ||
26 | </path> | ||
27 | </svg> | ||
28 | ); | ||
29 | |||
30 | export default Loading; | ||
31 |
imports/client/views/org/admin/app/module/navigation/PublicNavigation.js
File was created | 1 | import React, { Component } from 'react'; | |
2 | import { LinkContainer } from 'react-router-bootstrap'; | ||
3 | import { setQueryParam } from '/imports/client/app/utils/setQueryParam'; | ||
4 | import { browserHistory } from 'react-router'; | ||
5 | import { Nav, NavItem } from 'react-bootstrap'; | ||
6 | |||
7 | |||
8 | export class PublicNavigation extends Component { | ||
9 | constructor(props) { | ||
10 | super(props); | ||
11 | this.state = { | ||
12 | |||
13 | }; | ||
14 | }; | ||
15 | render(){ | ||
16 | console.log(this.props); | ||
17 | var mainSite = document.location.hostname.split( "." )[1]; | ||
18 | var signup = `http://${mainSite}/signup`; | ||
19 | return( | ||
20 | <Nav pullRight> | ||
21 | <LinkContainer to="login"> | ||
22 | <NavItem eventKey={ 2 } href="/login">Log In</NavItem> | ||
23 | </LinkContainer> | ||
24 | </Nav> | ||
25 | ) | ||
26 | } | ||
27 | } | ||
28 |
imports/client/views/org/admin/app/module/navigation/index.js
File was created | 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 | |||
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); | ||
50 |
imports/client/views/org/admin/dashboard/dashboard.js
File was created | 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 DashboardView 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 | <h1>Dashboard</h1> | ||
29 | </div> | ||
30 | ); | ||
31 | }; | ||
32 | |||
33 | }; | ||
34 |
imports/client/views/org/admin/dashboard/index.js
File was created | 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 { DashboardView } from './dashboard'; | ||
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 DashboardController = composeAll( | ||
46 | composeWithTracker(meteorTick, Loading), | ||
47 | compose(reduxTick, Loading), | ||
48 | )(DashboardView); | ||
49 |
imports/client/views/org/admin/parents/parentsview.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, | 6 | import { FormGroup, |
7 | FormControl,Glyphicon,Button } from 'react-bootstrap'; | 7 | FormControl,Glyphicon,Button } from 'react-bootstrap'; |
8 | import { Header } from '../Header'; | 8 | import { Header } from '../Header'; |
9 | import { AdminSidebar } from '../Sidebar' | 9 | import { AdminSidebar } from '../Sidebar' |
10 | import { AdminBreadcrumb } from '../Breadcrumb' | 10 | import { AdminBreadcrumb } from '../Breadcrumb' |
11 | import { ParentTable } from './view/ParentTable' | 11 | import { ParentTable } from './view/ParentTable' |
12 | 12 | ||
13 | 13 | ||
14 | export class ParentsView extends Component { | 14 | export class ParentsView extends Component { |
15 | 15 | ||
16 | constructor(props) { | 16 | constructor(props) { |
17 | super(props); | 17 | super(props); |
18 | this.state = { | 18 | this.state = { |
19 | 19 | ||
20 | }; | 20 | }; |
21 | this.onUpdate = this.onUpdate.bind(this); | 21 | this.onUpdate = this.onUpdate.bind(this); |
22 | }; | 22 | }; |
23 | 23 | ||
24 | onUpdate(key, value) { | 24 | onUpdate(key, value) { |
25 | this.setState({[key]: value}); | 25 | this.setState({[key]: value}); |
26 | }; | 26 | }; |
27 | togglePanel(){ | 27 | togglePanel(){ |
28 | this.setState({panleOpen: !this.state.panleOpen}); | 28 | this.setState({panleOpen: !this.state.panleOpen}); |
29 | } | 29 | } |
30 | 30 | ||
31 | render() { | 31 | render() { |
32 | const {user, org, parent} = this.props.data; | 32 | const {user, org, parent} = this.props.data; |
33 | return ( | 33 | return ( |
34 | <div className="appLayout-box"> | 34 | <div className="container-detached"> |
35 | <div className="page-container"> | 35 | <Header |
36 | <div className="page-content"> | 36 | user = {user} |
37 | <AdminSidebar | 37 | org = {org} |
38 | user = {user} | 38 | /> |
39 | org = {org} | 39 | <ParentTable |
40 | data = {this.props.data} | ||
41 | parent = {parent} | ||
40 | /> | 42 | /> |
41 | <div className="content-wrapper"> | 43 | {/* <AddStaff/> |
42 | <AdminBreadcrumb /> | 44 | <UploadCsvStaff /> */} |
43 | |||
44 | <div className="content has-detached-left"> | ||
45 | <div className="container-detached"> | ||
46 | <Header | ||
47 | user = {user} | ||
48 | org = {org} | ||
49 | /> | ||
50 | <ParentTable | ||
51 | data = {this.props.data} | ||
52 | parent = {parent} | ||
53 | /> | ||
54 | {/* <AddStaff/> | ||
55 | <UploadCsvStaff /> */} | ||
56 | </div> | ||
57 | </div> | ||
58 | </div> | ||
59 | </div> | ||
60 | </div> | ||
61 | </div> | 45 | </div> |
62 | ); | 46 | ); |
63 | }; | 47 | }; |
64 | 48 | ||
65 | 49 |
imports/client/views/org/admin/staff/StaffView.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, | 6 | import { FormGroup, |
7 | FormControl,Glyphicon,Button } from 'react-bootstrap'; | 7 | FormControl,Glyphicon,Button } from 'react-bootstrap'; |
8 | import { Header } from '../Header'; | 8 | import { Header } from '../Header'; |
9 | import { AdminSidebar } from '../Sidebar' | ||
10 | import { AdminBreadcrumb } from '../Breadcrumb' | ||
11 | import { StaffTable } from './view/StaffTable' | 9 | import { StaffTable } from './view/StaffTable' |
12 | import { AddStaff } from './add/addStaff' | 10 | import { AddStaff } from './add/addStaff' |
13 | import { UploadCsvStaff } from './UploadCsvStaff' | 11 | import { UploadCsvStaff } from './UploadCsvStaff' |
14 | 12 | ||
15 | export class StaffView extends Component { | 13 | export class StaffView extends Component { |
16 | constructor(props) { | 14 | constructor(props) { |
17 | super(props); | 15 | super(props); |
18 | this.state = { | 16 | this.state = { |
19 | 17 | ||
20 | }; | 18 | }; |
21 | this.onUpdate = this.onUpdate.bind(this); | 19 | this.onUpdate = this.onUpdate.bind(this); |
22 | }; | 20 | }; |
23 | 21 | ||
24 | onUpdate(key, value) { | 22 | onUpdate(key, value) { |
25 | this.setState({[key]: value}); | 23 | this.setState({[key]: value}); |
26 | }; | 24 | }; |
27 | 25 | ||
28 | render() { | 26 | render() { |
29 | const {user, org, staff} = this.props.data; | 27 | const {user, org, staff} = this.props.data; |
30 | return ( | 28 | return ( |
31 | <div className="appLayout-box"> | 29 | <div className="container-detached"> |
32 | <div className="page-container"> | 30 | <Header |
33 | <div className="page-content"> | 31 | user = {user} |
34 | <AdminSidebar | 32 | org = {org} |
35 | user = {user} | 33 | /> |
36 | org = {org} | 34 | <StaffTable |
37 | /> | 35 | data = {this.props.data} |
38 | <div className="content-wrapper"> | 36 | staff = {staff} |
39 | <AdminBreadcrumb /> | 37 | /> |
40 | <div className="content has-detached-left"> | 38 | <AddStaff/> |
41 | <div className="container-detached"> | 39 | <UploadCsvStaff /> |
42 | <Header | ||
43 | user = {user} | ||
44 | org = {org} | ||
45 | /> | ||
46 | <StaffTable | ||
47 | data = {this.props.data} | ||
48 | staff = {staff} | ||
49 | /> | ||
50 | <AddStaff/> | ||
51 | <UploadCsvStaff /> | ||
52 | </div> | ||
53 | </div> | ||
54 | </div> | ||
55 | </div> | ||
56 | </div> | ||
57 | </div> | 40 | </div> |
58 | ); | 41 | ); |
59 | }; | 42 | }; |
60 | 43 | ||
61 | }; | 44 | }; |
62 | 45 |
imports/client/views/org/admin/students/StudentView.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 { Navbar,Modal, Nav, NavItem, | 6 | import { Navbar,Modal, Nav, NavItem, |
7 | Glyphicon, Collapse, FormGroup, FormControl, Panel, | 7 | Glyphicon, Collapse, FormGroup, FormControl, Panel, |
8 | NavbarToggler, NavbarBrand, Table, ButtonToolbar, | 8 | NavbarToggler, NavbarBrand, Table, ButtonToolbar, |
9 | NavLink, DropdownItem, DropdownToggle, DropdownMenu, | 9 | NavLink, DropdownItem, DropdownToggle, DropdownMenu, |
10 | NavDropdown, MenuItem, Breadcrumb, Button } from 'react-bootstrap'; | 10 | NavDropdown, MenuItem, Breadcrumb, Button } from 'react-bootstrap'; |
11 | import { StudentTable } from './view/StudentTable'; | 11 | import { StudentTable } from './view/StudentTable'; |
12 | import { Header } from '../Header'; | 12 | import { Header } from '../Header'; |
13 | import { AdminSidebar } from '../Sidebar' | ||
14 | import { AdminBreadcrumb } from '../Breadcrumb' | ||
15 | import { UploadCsv } from './UploadCsv'; | 13 | import { UploadCsv } from './UploadCsv'; |
16 | import { AddStudent } from './add/addStudent'; | 14 | import { AddStudent } from './add/addStudent'; |
17 | import { Students } from '/imports/collections/students/index'; | 15 | import { Students } from '/imports/collections/students/index'; |
18 | import './student.css' | 16 | import './student.css' |
19 | 17 | ||
20 | export class StudentView extends Component { | 18 | export class StudentView extends Component { |
21 | 19 | ||
22 | constructor(props) { | 20 | constructor(props) { |
23 | super(props); | 21 | super(props); |
24 | this.state = { | 22 | this.state = { |
25 | show: false, | 23 | show: false, |
26 | firstNameSearch: "", | 24 | firstNameSearch: "", |
27 | lastNameSearch: "", | 25 | lastNameSearch: "", |
28 | }; | 26 | }; |
29 | this.showModal = this.showModal.bind(this); | 27 | this.showModal = this.showModal.bind(this); |
30 | this.hideModal = this.hideModal.bind(this); | 28 | this.hideModal = this.hideModal.bind(this); |
31 | this.onUpdate = this.onUpdate.bind(this); | 29 | this.onUpdate = this.onUpdate.bind(this); |
32 | }; | 30 | }; |
33 | 31 | ||
34 | showModal() { | 32 | showModal() { |
35 | this.setState({show: true}); | 33 | this.setState({show: true}); |
36 | } | 34 | } |
37 | 35 | ||
38 | hideModal() { | 36 | hideModal() { |
39 | this.setState({show: false}); | 37 | this.setState({show: false}); |
40 | } | 38 | } |
41 | onUpdate(key, value) { | 39 | onUpdate(key, value) { |
42 | this.setState({[key]: value}); | 40 | this.setState({[key]: value}); |
43 | }; | 41 | }; |
44 | 42 | ||
45 | render() { | 43 | render() { |
46 | firstNameSearch = this.state.firstNameSearch; | 44 | firstNameSearch = this.state.firstNameSearch; |
47 | lastNameSearch = this.state.lastNameSearch; | 45 | lastNameSearch = this.state.lastNameSearch; |
48 | var students =_.filter(this.props.data.students,function(item){ | 46 | var students =_.filter(this.props.data.students,function(item){ |
49 | if(item.firstName){ | 47 | if(item.firstName){ |
50 | return _.includes(item.firstName.toLowerCase(),firstNameSearch.toLowerCase()); | 48 | return _.includes(item.firstName.toLowerCase(),firstNameSearch.toLowerCase()); |
51 | } | 49 | } |
52 | }); | 50 | }); |
53 | return ( | 51 | return ( |
54 | <div className="appLayout-box"> | 52 | <div className="container-detached"> |
55 | <div className="page-container"> | 53 | <div className=""> |
56 | <div className="page-content"> | 54 | <Header/> |
57 | <AdminSidebar | 55 | <StudentTable |
58 | user = {this.props.data.user} | 56 | data = {this.props.data} |
59 | org = {this.props.data.org} | 57 | studentData = {studentData} |
60 | /> | 58 | /> |
61 | {/*end sidebar*/} | 59 | <AddStudent/> |
62 | <div className="content-wrapper"> | 60 | <UploadCsv /> |
63 | <AdminBreadcrumb /> | 61 | </div> |
64 | {/*content*/} | 62 | </div> |
65 | |||
66 | <div className="content has-detached-left"> | ||
67 | <div className="container-detached"> | ||
68 | <div className=""> | ||
69 | <Header/> | ||
70 | <StudentTable | ||
71 | data = {this.props.data} | ||
72 | studentData = {studentData} | ||
73 | /> | ||
74 | <AddStudent/> | ||
75 | <UploadCsv /> | ||
76 | </div> | ||
77 | </div> | ||
78 | </div> | ||
79 | </div> | ||
80 | </div> | ||
81 | </div> | ||
82 | </div> | ||
83 | ); | 63 | ); |
84 | }; | 64 | }; |
85 | 65 | ||
86 | }; | 66 | }; |
87 | 67 |
imports/client/views/org/app/module/AdminAppLayout.js
File was created | 1 | import _ from 'lodash'; | |
2 | import { Meteor } from 'meteor/meteor'; | ||
3 | import React, { Component } from 'react'; | ||
4 | import { Link } from 'react-router'; | ||
5 | import { Avatar } from '/imports/client/components/Avatar'; | ||
6 | import { Icon } from '/imports/client/components/Icon'; | ||
7 | import classNames from 'classnames'; | ||
8 | import { EnterModule } from '/imports/client/views/org/enter/module/index'; | ||
9 | // import { VerifyModule } from '/imports/client/views/verify/module/index'; | ||
10 | import { Navbar,Modal, Nav, NavItem, | ||
11 | Glyphicon, Collapse, | ||
12 | NavbarToggler, NavbarBrand, | ||
13 | NavLink, DropdownItem, DropdownToggle, DropdownMenu, | ||
14 | NavDropdown, MenuItem, Breadcrumb } from 'react-bootstrap'; | ||
15 | import { VerifyModule } from '/imports/client/views/verify/module/index' | ||
16 | import { AdminModule } from '/imports/client/views/org/admin/app/Index' | ||
17 | |||
18 | var Accordion = require('react-bootstrap').Accordion; | ||
19 | var Panel = require('react-bootstrap').Panel; | ||
20 | export class AdminAppLayout extends Component { | ||
21 | |||
22 | render() { | ||
23 | const {user, org} = this.props.data; | ||
24 | if(!user) { | ||
25 | return ( | ||
26 | <EnterModule | ||
27 | pane = {this.props.location.query.enter} | ||
28 | location = {this.props.location} | ||
29 | /> | ||
30 | ); | ||
31 | }else if(!user.isEmailVerified()) { | ||
32 | return ( | ||
33 | <VerifyModule | ||
34 | pane = {this.props.location.query.verify} | ||
35 | location = {this.props.location} | ||
36 | /> | ||
37 | ); | ||
38 | }else if(user.role==='ADMIN'){ | ||
39 | return( | ||
40 | <AdminModule | ||
41 | user = {user} | ||
42 | org = {org} | ||
43 | /> | ||
44 | ); | ||
45 | }else{ | ||
46 | return ( | ||
47 | null | ||
48 | ); | ||
49 | } | ||
50 | }; | ||
51 | |||
52 | }; | ||
53 |
imports/client/views/org/app/module/AppLayout.js
1 | import _ from 'lodash'; | File was deleted | |
2 | import { Meteor } from 'meteor/meteor'; | ||
3 | import React, { Component } from 'react'; | ||
4 | import { Link } from 'react-router'; | ||
5 | import { Avatar } from '/imports/client/components/Avatar'; | ||
6 | import { Icon } from '/imports/client/components/Icon'; | ||
7 | import classNames from 'classnames'; | ||
8 | import { EnterModule } from '/imports/client/views/org/enter/module/index'; | ||
9 | // import { VerifyModule } from '/imports/client/views/verify/module/index'; | ||
10 | import { Navbar,Modal, Nav, NavItem, | ||
11 | Glyphicon, Collapse, | ||
12 | NavbarToggler, NavbarBrand, | ||
13 | NavLink, DropdownItem, DropdownToggle, DropdownMenu, | ||
14 | NavDropdown, MenuItem, Breadcrumb } from 'react-bootstrap'; | ||
15 | import { VerifyModule } from '/imports/client/views/verify/module/index' | ||
16 | import { AdminAppLayout } from '/imports/client/views/org/admin/AdminLayout' | ||
17 | |||
18 | var Accordion = require('react-bootstrap').Accordion; | ||
19 | var Panel = require('react-bootstrap').Panel; | ||
20 | export class AppLayout extends Component { | ||
21 | |||
22 | render() { | ||
23 | const {user, org} = this.props.data; | ||
24 | if(!user) { | ||
25 | return ( | ||
26 | <EnterModule | ||
27 | pane = {this.props.location.query.enter} | ||
28 | location = {this.props.location} | ||
29 | /> | ||
30 | ); | ||
31 | }else if(!user.isEmailVerified()) { | ||
32 | return ( | ||
33 | <VerifyModule | ||
34 | pane = {this.props.location.query.verify} | ||
35 | location = {this.props.location} | ||
36 | /> | ||
37 | ); | ||
38 | }else if(user.role==='ADMIN'){ | ||
39 | return( | ||
40 | <AdminAppLayout | ||
41 | user = {user} | ||
42 | org = {org} | ||
43 | /> | ||
44 | ); | ||
45 | }else{ | ||
46 | return ( | ||
47 | null | ||
48 | ); | ||
49 | } | ||
50 | }; | ||
51 | |||
52 | }; | ||
53 | 1 | import _ from 'lodash'; |
imports/client/views/org/app/module/Index.js
1 | // import { AppModule } from '/imports/client/views/app/module/index' | 1 | // import { AppModule } from '/imports/client/views/app/module/index' |
2 | import { | 2 | import { |
3 | composeWithTracker, | 3 | composeWithTracker, |
4 | compose, | 4 | compose, |
5 | composeAll | 5 | composeAll |
6 | } from 'react-komposer'; | 6 | } from 'react-komposer'; |
7 | import { AppLayout } from './AppLayout'; | 7 | import { AdminAppLayout } from './AdminAppLayout'; |
8 | import { Loading } from '/imports/client/components/Loading'; | 8 | import { Loading } from '/imports/client/components/Loading'; |
9 | 9 | ||
10 | import { Users } from '/imports/collections/users/index'; | 10 | import { Users } from '/imports/collections/users/index'; |
11 | import { Orgs } from '/imports/collections/orgs/index'; | 11 | import { Orgs } from '/imports/collections/orgs/index'; |
12 | 12 | ||
13 | 13 | ||
14 | const meteorTick = (props, onData) => { | 14 | const meteorTick = (props, onData) => { |
15 | 15 | ||
16 | const handles = [ | 16 | const handles = [ |
17 | Meteor.subscribe('users.current'), | 17 | Meteor.subscribe('users.current'), |
18 | Meteor.subscribe('orgs.current'), | 18 | Meteor.subscribe('orgs.current'), |
19 | Meteor.subscribe('users.forMyOrg'), | 19 | Meteor.subscribe('users.forMyOrg'), |
20 | Meteor.subscribe('student.forMyOrg'), | 20 | Meteor.subscribe('student.forMyOrg'), |
21 | ]; | 21 | ]; |
22 | 22 | ||
23 | if(_.every(handles, (handle) => (handle.ready()) )) { | 23 | if(_.every(handles, (handle) => (handle.ready()) )) { |
24 | const user = Users.current(); | 24 | const user = Users.current(); |
25 | const org = Orgs.current(); | 25 | const org = Orgs.current(); |
26 | onData(null, { | 26 | onData(null, { |
27 | data: { | 27 | data: { |
28 | user: user, | 28 | user: user, |
29 | org: org, | 29 | org: org, |
30 | }, | 30 | }, |
31 | }); | 31 | }); |
32 | } | 32 | } |
33 | 33 | ||
34 | return () => { | 34 | return () => { |
35 | _.each(handles, (handle) => handle.stop() ); | 35 | _.each(handles, (handle) => handle.stop() ); |
36 | }; | 36 | }; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | 39 | ||
40 | const reduxTick = (props, onData) => { | 40 | const reduxTick = (props, onData) => { |
41 | onData(null, { | 41 | onData(null, { |
42 | location: props.location, | 42 | location: props.location, |
43 | data: {} | 43 | data: {} |
44 | }); | 44 | }); |
45 | }; | 45 | }; |
46 | 46 | ||
47 | 47 | ||
48 | export const AppModule = composeAll( | 48 | export const AdminAppModule = composeAll( |
49 | composeWithTracker(meteorTick, Loading), | 49 | composeWithTracker(meteorTick, Loading), |
50 | compose(reduxTick, Loading), | 50 | compose(reduxTick, Loading), |
51 | )(AppLayout); | 51 | )(AdminAppLayout); |
52 | 52 |
imports/client/views/org/app/module/navigation/AppNavigation.js
1 | import React, { Component } from 'react'; | File was deleted | |
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 { | ||
13 | |||
14 | constructor(props) { | ||
15 | super(props); | ||
16 | this.state = { | ||
17 | |||
18 | }; | ||
19 | }; | ||
20 | |||
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 | } | ||
48 | |||
49 | return ( | ||
50 | <div></div> | ||
51 | ); | ||
52 | }; | ||
53 | |||
54 | }; | ||
55 | 1 | import React, { Component } from 'react'; |
imports/client/views/org/app/module/navigation/AuthenticatedNavigation.js
1 | import React, { Component } from 'react'; | File was deleted | |
2 | import { browserHistory } from 'react-router'; | ||
3 | import { LinkContainer } from 'react-router-bootstrap'; | ||
4 | import { logout } from '/imports/client/app/utils/loginMethods'; | ||
5 | import { Navbar,Modal, Nav, NavItem, | ||
6 | Glyphicon, Collapse, | ||
7 | NavbarToggler, NavbarBrand, | ||
8 | NavLink, DropdownItem, DropdownToggle, DropdownMenu, | ||
9 | NavDropdown, MenuItem } from 'react-bootstrap'; | ||
10 | import { Meteor } from 'meteor/meteor'; | ||
11 | import $ from 'jquery'; | ||
12 | |||
13 | |||
14 | const handleLogout = () => Meteor.logout(() => browserHistory.push('/login')); | ||
15 | |||
16 | export class AuthenticatedNavigation extends Component { | ||
17 | constructor(props) { | ||
18 | super(props); | ||
19 | this.toggle = this.toggle.bind(this); | ||
20 | this.changeBodyClass = this.changeBodyClass.bind(this); | ||
21 | this.state = { | ||
22 | dropdownOpen: false, | ||
23 | burgerMenu: false | ||
24 | }; | ||
25 | } | ||
26 | toggle() { | ||
27 | this.setState({ | ||
28 | dropdownOpen: !this.state.dropdownOpen | ||
29 | }); | ||
30 | } | ||
31 | changeBodyClass(){ | ||
32 | if(this.state.burgerMenu){ | ||
33 | $('body').addClass('sidebar-xs'); | ||
34 | this.setState({burgerMenu: false}); | ||
35 | }else{ | ||
36 | $('body').removeClass('sidebar-xs'); | ||
37 | this.setState({burgerMenu: true}); | ||
38 | } | ||
39 | } | ||
40 | render(){ | ||
41 | const {user, org} = this.props.data; | ||
42 | return( | ||
43 | <Navbar inverse collapseOnSelect className="bg-crimson"> | ||
44 | <Navbar.Header> | ||
45 | <Navbar.Brand> | ||
46 | <a href="#"> | ||
47 | <Glyphicon glyph="link" /> | ||
48 | YoungDesk | ||
49 | </a> | ||
50 | </Navbar.Brand> | ||
51 | <ul className="nav navbar-nav visible-xs-block"> | ||
52 | <li><a href="#"><i className="icon-tree5"/></a></li> | ||
53 | <li><a className="sidebar-mobile-main-toggle"><i className="icon-paragraph-justify3"/></a></li> | ||
54 | </ul> | ||
55 | <Navbar.Toggle /> | ||
56 | </Navbar.Header> | ||
57 | <Navbar.Collapse id="navbar-mobile"> | ||
58 | <ul className="nav navbar-nav"> | ||
59 | <NavItem eventKey={1} href="#" className="sidebar-control sidebar-main-toggle hidden-xs"> | ||
60 | <i | ||
61 | className="icon-paragraph-justify3 burgerMenu" | ||
62 | onClick = {this.changeBodyClass} | ||
63 | /> | ||
64 | </NavItem> | ||
65 | |||
66 | <NavDropdown title="Dropdown" id="update"> | ||
67 | <div className="dropdown-content"> | ||
68 | <div className="dropdown-content-heading"> | ||
69 | Git updates | ||
70 | <ul className="icons-list"> | ||
71 | <li><a href="#"><i className="icon-sync"></i></a></li> | ||
72 | </ul> | ||
73 | |||
74 | </div> | ||
75 | <ul className="media-list dropdown-content-body width-350"> | ||
76 | <li className="media"> | ||
77 | <div className="media-left"> | ||
78 | <a href="#" className="btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-pull-request"></i></a> | ||
79 | </div> | ||
80 | |||
81 | <div className="media-body"> | ||
82 | Drop the IE <a href="#">specific hacks</a> for temporal inputs | ||
83 | <div className="media-annotation">4 minutes ago</div> | ||
84 | </div> | ||
85 | </li> | ||
86 | |||
87 | <li className="media"> | ||
88 | <div className="media-left"> | ||
89 | <a href="#" className="btn border-warning text-warning btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-commit"></i></a> | ||
90 | </div> | ||
91 | |||
92 | <div className="media-body"> | ||
93 | Add full font overrides for popovers and tooltips | ||
94 | <div className="media-annotation">36 minutes ago</div> | ||
95 | </div> | ||
96 | </li> | ||
97 | |||
98 | <li className="media"> | ||
99 | <div className="media-left"> | ||
100 | <a href="#" className="btn border-info text-info btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-branch"></i></a> | ||
101 | </div> | ||
102 | |||
103 | <div className="media-body"> | ||
104 | <a href="#">Chris Arney</a> created a new <span className="text-semibold">Design</span> branch | ||
105 | <div className="media-annotation">2 hours ago</div> | ||
106 | </div> | ||
107 | </li> | ||
108 | |||
109 | <li className="media"> | ||
110 | <div className="media-left"> | ||
111 | <a href="#" className="btn border-success text-success btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-merge"></i></a> | ||
112 | </div> | ||
113 | |||
114 | <div className="media-body"> | ||
115 | <a href="#">Eugene Kopyov</a> merged <span className="text-semibold">Master</span> and <span className="text-semibold">Dev</span> branches | ||
116 | <div className="media-annotation">Dec 18, 18:36</div> | ||
117 | </div> | ||
118 | </li> | ||
119 | |||
120 | <li className="media"> | ||
121 | <div className="media-left"> | ||
122 | <a href="#" className="btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-pull-request"></i></a> | ||
123 | </div> | ||
124 | |||
125 | <div className="media-body"> | ||
126 | Have Carousel ignore keyboard events | ||
127 | <div className="media-annotation">Dec 12, 05:46</div> | ||
128 | </div> | ||
129 | </li> | ||
130 | </ul> | ||
131 | <div className="dropdown-content-footer"> | ||
132 | <a href="#" data-popup="tooltip" title="All activity"><i className="icon-menu display-block"></i></a> | ||
133 | </div> | ||
134 | </div> | ||
135 | </NavDropdown> | ||
136 | </ul> | ||
137 | <div className="navbar-right"> | ||
138 | <p className="navbar-text">Hello {user.getFullName()}</p> | ||
139 | <p className="navbar-text" | ||
140 | onClick = {() => logout()} | ||
141 | > | ||
142 | <span className="label logout">logout</span> | ||
143 | </p> | ||
144 | <Nav> | ||
145 | <NavDropdown title="Activity" id="activity"> | ||
146 | <div className="dropdown-content"> | ||
147 | <div className="dropdown-content-heading"> | ||
148 | Activity | ||
149 | <ul className="icons-list"> | ||
150 | <li><a href="#"><i className="icon-menu7"></i></a></li> | ||
151 | </ul> | ||
152 | </div> | ||
153 | <ul className="media-list dropdown-content-body width-350"> | ||
154 | <li className="media"> | ||
155 | <div className="media-left"> | ||
156 | <a href="#" className="btn bg-success-400 btn-rounded btn-icon btn-xs"><i className="icon-mention"></i></a> | ||
157 | </div> | ||
158 | |||
159 | <div className="media-body"> | ||
160 | <a href="#">Taylor Swift</a> mentioned you in a post "Angular JS. Tips and tricks" | ||
161 | <div className="media-annotation">4 minutes ago</div> | ||
162 | </div> | ||
163 | </li> | ||
164 | <li className="media"> | ||
165 | <div className="media-left"> | ||
166 | <a href="#" className="btn bg-pink-400 btn-rounded btn-icon btn-xs"><i className="icon-paperplane"></i></a> | ||
167 | </div> | ||
168 | |||
169 | <div className="media-body"> | ||
170 | Special offers have been sent to subscribed users by <a href="#">Donna Gordon</a> | ||
171 | <div className="media-annotation">36 minutes ago</div> | ||
172 | </div> | ||
173 | </li> | ||
174 | <li className="media"> | ||
175 | <div className="media-left"> | ||
176 | <a href="#" className="btn bg-blue btn-rounded btn-icon btn-xs"><i className="icon-plus3"></i></a> | ||
177 | </div> | ||
178 | |||
179 | <div className="media-body"> | ||
180 | <a href="#">Chris Arney</a> created a new <span className="text-semibold">Design</span> branch in <span className="text-semibold">Limitless</span> repository | ||
181 | <div className="media-annotation">2 hours ago</div> | ||
182 | </div> | ||
183 | </li> | ||
184 | |||
185 | <li className="media"> | ||
186 | <div className="media-left"> | ||
187 | <a href="#" className="btn bg-purple-300 btn-rounded btn-icon btn-xs"><i className="icon-truck"></i></a> | ||
188 | </div> | ||
189 | |||
190 | <div className="media-body"> | ||
191 | Shipping cost to the Netherlands has been reduced, database updated | ||
192 | <div className="media-annotation">Feb 8, 11:30</div> | ||
193 | </div> | ||
194 | </li> | ||
195 | |||
196 | <li className="media"> | ||
197 | <div className="media-left"> | ||
198 | <a href="#" className="btn bg-warning-400 btn-rounded btn-icon btn-xs"><i className="icon-bubble8"></i></a> | ||
199 | </div> | ||
200 | |||
201 | <div className="media-body"> | ||
202 | New review received on <a href="#">Server side integration</a> services | ||
203 | <div className="media-annotation">Feb 2, 10:20</div> | ||
204 | </div> | ||
205 | </li> | ||
206 | |||
207 | <li className="media"> | ||
208 | <div className="media-left"> | ||
209 | <a href="#" className="btn bg-teal-400 btn-rounded btn-icon btn-xs"><i className="icon-spinner11"></i></a> | ||
210 | </div> | ||
211 | |||
212 | <div className="media-body"> | ||
213 | <strong>January, 2016</strong> - 1320 new users, 3284 orders, $49,390 revenue | ||
214 | <div className="media-annotation">Feb 1, 05:46</div> | ||
215 | </div> | ||
216 | </li> | ||
217 | </ul> | ||
218 | </div> | ||
219 | </NavDropdown> | ||
220 | <NavDropdown title="Messages" id="messages"> | ||
221 | <div className="dropdown-content width-350"> | ||
222 | <div className="dropdown-content-heading"> | ||
223 | Messages | ||
224 | <ul className="icons-list"> | ||
225 | <li><a href="#"><i className="icon-compose"></i></a></li> | ||
226 | </ul> | ||
227 | </div> | ||
228 | |||
229 | <ul className="media-list dropdown-content-body"> | ||
230 | <li className="media"> | ||
231 | <div className="media-left"> | ||
232 | |||
233 | <span className="badge bg-danger-400 media-badge">5</span> | ||
234 | </div> | ||
235 | |||
236 | <div className="media-body"> | ||
237 | <a href="#" className="media-heading"> | ||
238 | <span className="text-semibold">James Alexander</span> | ||
239 | <span className="media-annotation pull-right">04:58</span> | ||
240 | </a> | ||
241 | |||
242 | <span className="text-muted">who knows, maybe that would be the best thing for me...</span> | ||
243 | </div> | ||
244 | </li> | ||
245 | |||
246 | <li className="media"> | ||
247 | <div className="media-left"> | ||
248 | |||
249 | <span className="badge bg-danger-400 media-badge">4</span> | ||
250 | </div> | ||
251 | |||
252 | <div className="media-body"> | ||
253 | <a href="#" className="media-heading"> | ||
254 | <span className="text-semibold">Margo Baker</span> | ||
255 | <span className="media-annotation pull-right">12:16</span> | ||
256 | </a> | ||
257 | |||
258 | <span className="text-muted">That was something he was unable to do because...</span> | ||
259 | </div> | ||
260 | </li> | ||
261 | |||
262 | <li className="media"> | ||
263 | <div className="media-left"></div> | ||
264 | <div className="media-body"> | ||
265 | <a href="#" className="media-heading"> | ||
266 | <span className="text-semibold">Jeremy Victorino</span> | ||
267 | <span className="media-annotation pull-right">22:48</span> | ||
268 | </a> | ||
269 | |||
270 | <span className="text-muted">But that would be extremely strained and suspicious...</span> | ||
271 | </div> | ||
272 | </li> | ||
273 | |||
274 | <li className="media"> | ||
275 | <div className="media-left"></div> | ||
276 | <div className="media-body"> | ||
277 | <a href="#" className="media-heading"> | ||
278 | <span className="text-semibold">Beatrix Diaz</span> | ||
279 | <span className="media-annotation pull-right">Tue</span> | ||
280 | </a> | ||
281 | |||
282 | <span className="text-muted">What a strenuous career it is that I have chosen...</span> | ||
283 | </div> | ||
284 | </li> | ||
285 | |||
286 | <li className="media"> | ||
287 | <div className="media-left"> | ||
288 | |||
289 | </div> | ||
290 | <div className="media-body"> | ||
291 | <a href="#" className="media-heading"> | ||
292 | <span className="text-semibold">Richard Vango</span> | ||
293 | <span className="media-annotation pull-right">Mon</span> | ||
294 | </a> | ||
295 | |||
296 | <span className="text-muted">Other travelling salesmen live a life of luxury...</span> | ||
297 | </div> | ||
298 | </li> | ||
299 | </ul> | ||
300 | |||
301 | <div className="dropdown-content-footer"> | ||
302 | <a href="#" data-popup="tooltip" title="All messages"><i className="icon-menu display-block"></i></a> | ||
303 | </div> | ||
304 | </div> | ||
305 | </NavDropdown> | ||
306 | </Nav> | ||
307 | </div> | ||
308 | </Navbar.Collapse> | ||
309 | </Navbar> | ||
310 | ); | ||
311 | } | ||
312 | } | ||
313 | 1 | import React, { Component } from 'react'; |
imports/client/views/org/app/module/navigation/AuthenticatedNavigation0.js
1 | import React, { Component } from 'react'; | File was deleted | |
2 | import { browserHistory } from 'react-router'; | ||
3 | import { LinkContainer } from 'react-router-bootstrap'; | ||
4 | import { Nav, NavItem, | ||
5 | NavDropdown, MenuItem } from 'react-bootstrap'; | ||
6 | import { Meteor } from 'meteor/meteor'; | ||
7 | |||
8 | const handleLogout = () => Meteor.logout(() => browserHistory.push('/login')); | ||
9 | |||
10 | export class AuthenticatedNavigation extends Component { | ||
11 | constructor(props) { | ||
12 | super(props); | ||
13 | this.state = { | ||
14 | |||
15 | }; | ||
16 | }; | ||
17 | render(){ | ||
18 | const {user} = this.props.data; | ||
19 | return( | ||
20 | <div> | ||
21 | <div className="navbar navbar-inverse bg-crimson"> | ||
22 | <div className="navbar-header"> | ||
23 | <a className="navbar-brand" href="index.html"><span className="glyphicon glyphicon-link"></span> | ||
24 | <span> YOUNGDESK </span> | ||
25 | </a> | ||
26 | |||
27 | <ul className="nav navbar-nav visible-xs-block"> | ||
28 | <li><a data-toggle="collapse" data-target="#navbar-mobile"><i className="icon-tree5"></i></a></li> | ||
29 | <li><a className="sidebar-mobile-main-toggle"><i className="icon-paragraph-justify3"></i></a></li> | ||
30 | </ul> | ||
31 | </div> | ||
32 | |||
33 | <div className="navbar-collapse collapse" id="navbar-mobile"> | ||
34 | <ul className="nav navbar-nav"> | ||
35 | <li><a className="sidebar-control sidebar-main-toggle hidden-xs"><i className="icon-paragraph-justify3"></i></a></li> | ||
36 | |||
37 | <li className="dropdown"> | ||
38 | <a href="#" className="dropdown-toggle" data-toggle="dropdown"> | ||
39 | <i className="icon-puzzle3"></i> | ||
40 | <span className="visible-xs-inline-block position-right">Git updates</span> | ||
41 | <span className="status-mark border-orange-400"></span> | ||
42 | </a> | ||
43 | |||
44 | <div className="dropdown-menu dropdown-content"> | ||
45 | <div className="dropdown-content-heading"> | ||
46 | Git updates | ||
47 | <ul className="icons-list"> | ||
48 | <li><a href="#"><i className="icon-sync"></i></a></li> | ||
49 | </ul> | ||
50 | </div> | ||
51 | |||
52 | <ul className="media-list dropdown-content-body width-350"> | ||
53 | <li className="media"> | ||
54 | <div className="media-left"> | ||
55 | <a href="#" className="btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-pull-request"></i></a> | ||
56 | </div> | ||
57 | |||
58 | <div className="media-body"> | ||
59 | Drop the IE <a href="#">specific hacks</a> for temporal inputs | ||
60 | <div className="media-annotation">4 minutes ago</div> | ||
61 | </div> | ||
62 | </li> | ||
63 | |||
64 | <li className="media"> | ||
65 | <div className="media-left"> | ||
66 | <a href="#" className="btn border-warning text-warning btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-commit"></i></a> | ||
67 | </div> | ||
68 | |||
69 | <div className="media-body"> | ||
70 | Add full font overrides for popovers and tooltips | ||
71 | <div className="media-annotation">36 minutes ago</div> | ||
72 | </div> | ||
73 | </li> | ||
74 | |||
75 | <li className="media"> | ||
76 | <div className="media-left"> | ||
77 | <a href="#" className="btn border-info text-info btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-branch"></i></a> | ||
78 | </div> | ||
79 | |||
80 | <div className="media-body"> | ||
81 | <a href="#">Chris Arney</a> created a new <span className="text-semibold">Design</span> branch | ||
82 | <div className="media-annotation">2 hours ago</div> | ||
83 | </div> | ||
84 | </li> | ||
85 | |||
86 | <li className="media"> | ||
87 | <div className="media-left"> | ||
88 | <a href="#" className="btn border-success text-success btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-merge"></i></a> | ||
89 | </div> | ||
90 | |||
91 | <div className="media-body"> | ||
92 | <a href="#">Eugene Kopyov</a> merged <span className="text-semibold">Master</span> and <span className="text-semibold">Dev</span> branches | ||
93 | <div className="media-annotation">Dec 18, 18:36</div> | ||
94 | </div> | ||
95 | </li> | ||
96 | |||
97 | <li className="media"> | ||
98 | <div className="media-left"> | ||
99 | <a href="#" className="btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm"><i className="icon-git-pull-request"></i></a> | ||
100 | </div> | ||
101 | |||
102 | <div className="media-body"> | ||
103 | Have Carousel ignore keyboard events | ||
104 | <div className="media-annotation">Dec 12, 05:46</div> | ||
105 | </div> | ||
106 | </li> | ||
107 | </ul> | ||
108 | |||
109 | <div className="dropdown-content-footer"> | ||
110 | <a href="#" data-popup="tooltip" title="All activity"><i className="icon-menu display-block"></i></a> | ||
111 | </div> | ||
112 | </div> | ||
113 | </li> | ||
114 | </ul> | ||
115 | |||
116 | <div className="navbar-right"> | ||
117 | <p className="navbar-text">Hello {`${user.firstName} ${user.lastName}`}!</p> | ||
118 | <p className="navbar-text"><span className="label bg-success-400">Online</span></p> | ||
119 | |||
120 | <ul className="nav navbar-nav"> | ||
121 | <li className="dropdown"> | ||
122 | <a href="#" className="dropdown-toggle" data-toggle="dropdown"> | ||
123 | <i className="icon-bell2"></i> | ||
124 | <span className="visible-xs-inline-block position-right">Activity</span> | ||
125 | <span className="status-mark border-orange-400"></span> | ||
126 | </a> | ||
127 | |||
128 | <div className="dropdown-menu dropdown-content"> | ||
129 | <div className="dropdown-content-heading"> | ||
130 | Activity | ||
131 | <ul className="icons-list"> | ||
132 | <li><a href="#"><i className="icon-menu7"></i></a></li> | ||
133 | </ul> | ||
134 | </div> | ||
135 | |||
136 | <ul className="media-list dropdown-content-body width-350"> | ||
137 | <li className="media"> | ||
138 | <div className="media-left"> | ||
139 | <a href="#" className="btn bg-success-400 btn-rounded btn-icon btn-xs"><i className="icon-mention"></i></a> | ||
140 | </div> | ||
141 | |||
142 | <div className="media-body"> | ||
143 | <a href="#">Taylor Swift</a> mentioned you in a post "Angular JS. Tips and tricks" | ||
144 | <div className="media-annotation">4 minutes ago</div> | ||
145 | </div> | ||
146 | </li> | ||
147 | |||
148 | <li className="media"> | ||
149 | <div className="media-left"> | ||
150 | <a href="#" className="btn bg-pink-400 btn-rounded btn-icon btn-xs"><i className="icon-paperplane"></i></a> | ||
151 | </div> | ||
152 | |||
153 | <div className="media-body"> | ||
154 | Special offers have been sent to subscribed users by <a href="#">Donna Gordon</a> | ||
155 | <div className="media-annotation">36 minutes ago</div> | ||
156 | </div> | ||
157 | </li> | ||
158 | |||
159 | <li className="media"> | ||
160 | <div className="media-left"> | ||
161 | <a href="#" className="btn bg-blue btn-rounded btn-icon btn-xs"><i className="icon-plus3"></i></a> | ||
162 | </div> | ||
163 | |||
164 | <div className="media-body"> | ||
165 | <a href="#">Chris Arney</a> created a new <span className="text-semibold">Design</span> branch in <span className="text-semibold">Limitless</span> repository | ||
166 | <div className="media-annotation">2 hours ago</div> | ||
167 | </div> | ||
168 | </li> | ||
169 | |||
170 | <li className="media"> | ||
171 | <div className="media-left"> | ||
172 | <a href="#" className="btn bg-purple-300 btn-rounded btn-icon btn-xs"><i className="icon-truck"></i></a> | ||
173 | </div> | ||
174 | |||
175 | <div className="media-body"> | ||
176 | Shipping cost to the Netherlands has been reduced, database updated | ||
177 | <div className="media-annotation">Feb 8, 11:30</div> | ||
178 | </div> | ||
179 | </li> | ||
180 | |||
181 | <li className="media"> | ||
182 | <div className="media-left"> | ||
183 | <a href="#" className="btn bg-warning-400 btn-rounded btn-icon btn-xs"><i className="icon-bubble8"></i></a> | ||
184 | </div> | ||
185 | |||
186 | <div className="media-body"> | ||
187 | New review received on <a href="#">Server side integration</a> services | ||
188 | <div className="media-annotation">Feb 2, 10:20</div> | ||
189 | </div> | ||
190 | </li> | ||
191 | |||
192 | <li className="media"> | ||
193 | <div className="media-left"> | ||
194 | <a href="#" className="btn bg-teal-400 btn-rounded btn-icon btn-xs"><i className="icon-spinner11"></i></a> | ||
195 | </div> | ||
196 | |||
197 | <div className="media-body"> | ||
198 | <strong>January, 2016</strong> - 1320 new users, 3284 orders, $49,390 revenue | ||
199 | <div className="media-annotation">Feb 1, 05:46</div> | ||
200 | </div> | ||
201 | </li> | ||
202 | </ul> | ||
203 | </div> | ||
204 | </li> | ||
205 | |||
206 | <li className="dropdown"> | ||
207 | <a href="#" className="dropdown-toggle" data-toggle="dropdown"> | ||
208 | <i className="icon-bubble8"></i> | ||
209 | <span className="visible-xs-inline-block position-right">Messages</span> | ||
210 | <span className="status-mark border-orange-400"></span> | ||
211 | </a> | ||
212 | |||
213 | <div className="dropdown-menu dropdown-content width-350"> | ||
214 | <div className="dropdown-content-heading"> | ||
215 | Messages | ||
216 | <ul className="icons-list"> | ||
217 | <li><a href="#"><i className="icon-compose"></i></a></li> | ||
218 | </ul> | ||
219 | </div> | ||
220 | |||
221 | <ul className="media-list dropdown-content-body"> | ||
222 | <li className="media"> | ||
223 | <div className="media-left"> | ||
224 | <img src="assets/images/placeholder.jpg" className="img-circle img-sm" alt="" /> | ||
225 | <span className="badge bg-danger-400 media-badge">5</span> | ||
226 | </div> | ||
227 | |||
228 | <div className="media-body"> | ||
229 | <a href="#" className="media-heading"> | ||
230 | <span className="text-semibold">James Alexander</span> | ||
231 | <span className="media-annotation pull-right">04:58</span> | ||
232 | </a> | ||
233 | |||
234 | <span className="text-muted">who knows, maybe that would be the best thing for me...</span> | ||
235 | </div> | ||
236 | </li> | ||
237 | |||
238 | <li className="media"> | ||
239 | <div className="media-left"> | ||
240 | <img src="assets/images/placeholder.jpg" className="img-circle img-sm" alt="" /> | ||
241 | <span className="badge bg-danger-400 media-badge">4</span> | ||
242 | </div> | ||
243 | |||
244 | <div className="media-body"> | ||
245 | <a href="#" className="media-heading"> | ||
246 | <span className="text-semibold">Margo Baker</span> | ||
247 | <span className="media-annotation pull-right">12:16</span> | ||
248 | </a> | ||
249 | |||
250 | <span className="text-muted">That was something he was unable to do because...</span> | ||
251 | </div> | ||
252 | </li> | ||
253 | |||
254 | <li className="media"> | ||
255 | <div className="media-left"><img src="assets/images/placeholder.jpg" className="img-circle img-sm" alt="" /></div> | ||
256 | <div className="media-body"> | ||
257 | <a href="#" className="media-heading"> | ||
258 | <span className="text-semibold">Jeremy Victorino</span> | ||
259 | <span className="media-annotation pull-right">22:48</span> | ||
260 | </a> | ||
261 | |||
262 | <span className="text-muted">But that would be extremely strained and suspicious...</span> | ||
263 | </div> | ||
264 | </li> | ||
265 | |||
266 | <li className="media"> | ||
267 | <div className="media-left"><img src="assets/images/placeholder.jpg" className="img-circle img-sm" alt="" /></div> | ||
268 | <div className="media-body"> | ||
269 | <a href="#" className="media-heading"> | ||
270 | <span className="text-semibold">Beatrix Diaz</span> | ||
271 | <span className="media-annotation pull-right">Tue</span> | ||
272 | </a> | ||
273 | |||
274 | <span className="text-muted">What a strenuous career it is that I have chosen...</span> | ||
275 | </div> | ||
276 | </li> | ||
277 | |||
278 | <li className="media"> | ||
279 | <div className="media-left"><img src="assets/images/placeholder.jpg" className="img-circle img-sm" alt="" /></div> | ||
280 | <div className="media-body"> | ||
281 | <a href="#" className="media-heading"> | ||
282 | <span className="text-semibold">Richard Vango</span> | ||
283 | <span className="media-annotation pull-right">Mon</span> | ||
284 | </a> | ||
285 | |||
286 | <span className="text-muted">Other travelling salesmen live a life of luxury...</span> | ||
287 | </div> | ||
288 | </li> | ||
289 | </ul> | ||
290 | |||
291 | <div className="dropdown-content-footer"> | ||
292 | <a href="#" data-popup="tooltip" title="All messages"><i className="icon-menu display-block"></i></a> | ||
293 | </div> | ||
294 | </div> | ||
295 | </li> | ||
296 | </ul> | ||
297 | </div> | ||
298 | </div> | ||
299 | </div> | ||
300 | </div> | ||
301 | ); | ||
302 | } | ||
303 | } | ||
304 | 1 | import React, { Component } from 'react'; |
imports/client/views/org/app/module/navigation/Loading.js
1 | import React from 'react'; | File was deleted | |
2 | |||
3 | const Loading = () => ( | ||
4 | <svg | ||
5 | version="1.1" | ||
6 | className="Loading" | ||
7 | xmlns="http://www.w3.org/2000/svg" | ||
8 | x="0px" | ||
9 | y="0px" | ||
10 | width="40px" | ||
11 | height="40px" | ||
12 | viewBox="0 0 40 40" | ||
13 | enableBackground="new 0 0 40 40"> | ||
14 | <path | ||
15 | opacity="1.0" | ||
16 | fill="#eee" | ||
17 | d="M20.201,5.169c-8.254,0-14.946,6.692-14.946,14.946c0,8.255,6.692,14.946, | ||
18 | 14.946,14.946s14.946-6.691,14.946-14.946C35.146,11.861,28.455,5.169,20.201, | ||
19 | 5.169z M20.201,31.749c-6.425,0-11.634-5.208-11.634-11.634c0-6.425, | ||
20 | 5.209-11.634,11.634-11.634c6.425,0,11.633,5.209,11.633,11.634C31.834, | ||
21 | 26.541,26.626,31.749,20.201,31.749z"/> | ||
22 | <path | ||
23 | fill="#da5347" | ||
24 | d="M26.013,10.047l1.654-2.866c-2.198-1.272-4.743-2.012-7.466-2.012h0v3.312h0 | ||
25 | C22.32,8.481,24.301,9.057,26.013,10.047z"> | ||
26 | </path> | ||
27 | </svg> | ||
28 | ); | ||
29 | |||
30 | export default Loading; | ||
31 | 1 | import React from 'react'; |
imports/client/views/org/app/module/navigation/PublicNavigation.js
1 | import React, { Component } from 'react'; | File was deleted | |
2 | import { LinkContainer } from 'react-router-bootstrap'; | ||
3 | import { setQueryParam } from '/imports/client/app/utils/setQueryParam'; | ||
4 | import { browserHistory } from 'react-router'; | ||
5 | import { Nav, NavItem } from 'react-bootstrap'; | ||
6 | |||
7 | |||
8 | export class PublicNavigation extends Component { | ||
9 | constructor(props) { | ||
10 | super(props); | ||
11 | this.state = { | ||
12 | |||
13 | }; | ||
14 | }; | ||
15 | render(){ | ||
16 | console.log(this.props); | ||
17 | var mainSite = document.location.hostname.split( "." )[1]; | ||
18 | var signup = `http://${mainSite}/signup`; | ||
19 | return( | ||
20 | <Nav pullRight> | ||
21 | <LinkContainer to="login"> | ||
22 | <NavItem eventKey={ 2 } href="/login">Log In</NavItem> | ||
23 | </LinkContainer> | ||
24 | </Nav> | ||
25 | ) | ||
26 | } | ||
27 | } | ||
28 | 1 | import React, { Component } from 'react'; |
imports/client/views/org/app/module/navigation/index.js
1 | // import { InviteSignupController } from '/imports/client/views/invite/signup/index' | File was deleted | |
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 | |||
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); | ||
50 | 1 | // import { InviteSignupController } from '/imports/client/views/invite/signup/index' |
imports/collections/users/index.js
1 | // import { Users } from '/imports/collections/users/index'; | 1 | // import { Users } from '/imports/collections/users/index'; |
2 | // import { Users } from '/imports/collections/users/index'; | 2 | // import { Users } from '/imports/collections/users/index'; |
3 | 3 | ||
4 | import _ from 'lodash'; | 4 | import _ from 'lodash'; |
5 | import { Meteor } from 'meteor/meteor'; | 5 | import { Meteor } from 'meteor/meteor'; |
6 | import { Mongo } from 'meteor/mongo'; | 6 | import { Mongo } from 'meteor/mongo'; |
7 | import { SimpleSchema } from 'meteor/aldeed:simple-schema'; | 7 | import { SimpleSchema } from 'meteor/aldeed:simple-schema'; |
8 | 8 | ||
9 | import { Orgs } from '/imports/collections/orgs/index'; | 9 | import { Orgs } from '/imports/collections/orgs/index'; |
10 | 10 | ||
11 | class User { | 11 | class User { |
12 | 12 | ||
13 | constructor(doc) { | 13 | constructor(doc) { |
14 | _.assign(this, doc); | 14 | _.assign(this, doc); |
15 | }; | 15 | }; |
16 | 16 | ||
17 | isEmailVerified() { | 17 | isEmailVerified() { |
18 | return !! _.find(this.emails, x => x.verified); | 18 | return !! _.find(this.emails, x => x.verified); |
19 | }; | 19 | }; |
20 | 20 | ||
21 | isPhoneVerified() { | 21 | isPhoneVerified() { |
22 | return !! _.find(this.phones, x => x.verified); | 22 | return !! _.find(this.phones, x => x.verified); |
23 | }; | 23 | }; |
24 | 24 | ||
25 | isIdentityVerified() { | 25 | isIdentityVerified() { |
26 | return !! _.find(this.identities, x => x.verified); | 26 | return !! _.find(this.identities, x => x.verified); |
27 | }; | 27 | }; |
28 | 28 | ||
29 | getRole() { | 29 | getRole() { |
30 | return (this._id); | ||
30 | const org = Orgs.findOne({_id: this.orgId}); | 31 | const org = Orgs.findOne({_id: this.orgId}); |
31 | if(!org) return null; | 32 | if(!org) return null; |
32 | const connection = _.find(org.users, {userId: this._id}); | 33 | const connection = _.find(org.users, {userId: this._id}); |
33 | if(!connection) return null; | 34 | if(!connection) return null; |
34 | return connection.role; | 35 | return connection.role; |
35 | }; | 36 | }; |
36 | 37 | ||
37 | getFullName() { | 38 | getFullName() { |
38 | return `${this.firstName} ${this.lastName}`; | 39 | return `${this.firstName} ${this.lastName}`; |
39 | }; | 40 | }; |
40 | getFirstName() { | 41 | getFirstName() { |
41 | return `${this.firstName}`; | 42 | return `${this.firstName}`; |
42 | }; | 43 | }; |
43 | getLastName() { | 44 | getLastName() { |
44 | return `${this.lastName}`; | 45 | return `${this.lastName}`; |
45 | }; | 46 | }; |
46 | getEmail() { | 47 | getEmail() { |
47 | return `${this.emails[0].address}`; | 48 | return `${this.emails[0].address}`; |
48 | }; | 49 | }; |
49 | getOrganization(){ | 50 | getOrganization(){ |
50 | return `${this.orgId}`; | 51 | return `${this.orgId}`; |
51 | }; | 52 | }; |
52 | 53 | ||
53 | getNameByUserId(userId){ | 54 | getNameByUserId(userId){ |
54 | var user = Users.findOne({"_id":userId}); | 55 | var user = Users.findOne({"_id":userId}); |
55 | return user.firstName + " " + user.lastName; | 56 | return user.firstName + " " + user.lastName; |
56 | } | 57 | } |
57 | getAvatarUrl() { | 58 | getAvatarUrl() { |
58 | let random = parseInt(this._id.substr(0, 4), 36); | 59 | let random = parseInt(this._id.substr(0, 4), 36); |
59 | random = '' + (random % 32); | 60 | random = '' + (random % 32); |
60 | while(random.length < 3) random = '0' + random; | 61 | while(random.length < 3) random = '0' + random; |
61 | return `/files/random/random${ random }.png`; | 62 | return `/files/random/random${ random }.png`; |
62 | }; | 63 | }; |
63 | }; | 64 | }; |
64 | 65 | ||
65 | export { User }; | 66 | export { User }; |
66 | 67 | ||
67 | 68 | ||
68 | const transform = function(doc) { | 69 | const transform = function(doc) { |
69 | return new User(doc); | 70 | return new User(doc); |
70 | }; | 71 | }; |
71 | 72 | ||
72 | export const Users = { | 73 | export const Users = { |
73 | 74 | ||
74 | current: function() { | 75 | current: function() { |
75 | return Meteor.users.findOne({_id: Meteor.userId()}, _.extend({transform: transform})); | 76 | return Meteor.users.findOne({_id: Meteor.userId()}, _.extend({transform: transform})); |
76 | }, | 77 | }, |
77 | 78 | ||
78 | find: function(selector, options) { | 79 | find: function(selector, options) { |
79 | return Meteor.users.find(selector || {}, _.extend({transform: transform}, options)); | 80 | return Meteor.users.find(selector || {}, _.extend({transform: transform}, options)); |
80 | }, | 81 | }, |
81 | 82 | ||
82 | findOne: function(selector, options) { | 83 | findOne: function(selector, options) { |
83 | return Meteor.users.findOne(selector || {}, _.extend({transform: transform}, options)); | 84 | return Meteor.users.findOne(selector || {}, _.extend({transform: transform}, options)); |
84 | }, | 85 | }, |
85 | 86 | ||
86 | insert: _.bind(Meteor.users.insert, Meteor.users), | 87 | insert: _.bind(Meteor.users.insert, Meteor.users), |
87 | update: _.bind(Meteor.users.update, Meteor.users), | 88 | update: _.bind(Meteor.users.update, Meteor.users), |
88 | remove: _.bind(Meteor.users.remove, Meteor.users), | 89 | remove: _.bind(Meteor.users.remove, Meteor.users), |
89 | allow: _.bind(Meteor.users.allow, Meteor.users), | 90 | allow: _.bind(Meteor.users.allow, Meteor.users), |
90 | deny: _.bind(Meteor.users.deny, Meteor.users), | 91 | deny: _.bind(Meteor.users.deny, Meteor.users), |
91 | attachSchema: _.bind(Meteor.users.attachSchema, Meteor.users), | 92 | attachSchema: _.bind(Meteor.users.attachSchema, Meteor.users), |
92 | 93 | ||
93 | }; | 94 | }; |
94 | 95 | ||
95 | 96 | ||
96 | Users.deny({ | 97 | Users.deny({ |
97 | insert() { return true; }, | 98 | insert() { return true; }, |
98 | update() { return true; }, | 99 | update() { return true; }, |
99 | remove() { return true; }, | 100 | remove() { return true; }, |
100 | }); | 101 | }); |
101 | 102 | ||
102 | Users.roles = { | 103 | Users.roles = { |
103 | 'STUDENT': 'STUDENT', | 104 | 'STUDENT': 'STUDENT', |
104 | 'STAFF': 'STAFF', | 105 | 'STAFF': 'STAFF', |
105 | 'ADMIN': 'ADMIN', | 106 | 'ADMIN': 'ADMIN', |
106 | 'PARENT': 'PARENT' | 107 | 'PARENT': 'PARENT' |
107 | }; | 108 | }; |
108 | 109 | ||
109 | 110 | ||
110 | Users.schema = new SimpleSchema({ | 111 | Users.schema = new SimpleSchema({ |
111 | role: { type: String }, | 112 | role: { type: String }, |
112 | orgId: { type: String }, | 113 | orgId: { type: String }, |
113 | username: { type: String, optional: true }, | 114 | username: { type: String, optional: true }, |
114 | prefix: { type: String, optional: true }, | 115 | prefix: { type: String, optional: true }, |
115 | firstName: { type: String, optional: true }, | 116 | firstName: { type: String, optional: true }, |
116 | middlename: { type: String, optional: true }, | 117 | middlename: { type: String, optional: true }, |
117 | lastName: { type: String, optional: true }, | 118 | lastName: { type: String, optional: true }, |
118 | address: { type: String, optional: true, }, | 119 | address: { type: String, optional: true, }, |
119 | gender: { type: String, optional: true }, | 120 | gender: { type: String, optional: true }, |
120 | dob: { type: String, optional: true }, | 121 | dob: { type: String, optional: true }, |
121 | emails: { | 122 | emails: { |
122 | type: [new SimpleSchema({ | 123 | type: [new SimpleSchema({ |
123 | address: { type: String, }, | 124 | address: { type: String, }, |
124 | verified: { type: Boolean, }, | 125 | verified: { type: Boolean, }, |
125 | })], | 126 | })], |
126 | optional: true | 127 | optional: true |
127 | }, | 128 | }, |
128 | phones: { | 129 | phones: { |
129 | type: [new SimpleSchema({ | 130 | type: [new SimpleSchema({ |
130 | country: { type: String, optional: true }, | 131 | country: { type: String, optional: true }, |
131 | prefix: { type: String, optional: true }, | 132 | prefix: { type: String, optional: true }, |
132 | number: { type: String, }, | 133 | number: { type: String, }, |
133 | verified: { type: Boolean, }, | 134 | verified: { type: Boolean, }, |
134 | })], | 135 | })], |
135 | optional: true | 136 | optional: true |
136 | }, | 137 | }, |
137 | 138 | ||
138 | services: { | 139 | services: { |
139 | type: Object, | 140 | type: Object, |
140 | optional: true, | 141 | optional: true, |
141 | blackbox: true, | 142 | blackbox: true, |
142 | }, | 143 | }, |
143 | 144 | ||
144 | isMetaUser: { type: Boolean, optional: true }, | 145 | isMetaUser: { type: Boolean, optional: true }, |
145 | 146 | ||
146 | createdAt: { type: Date, autoValue: function(){return new Date();}} | 147 | createdAt: { type: Date, autoValue: function(){return new Date();}} |
147 | 148 | ||
148 | }); | 149 | }); |
149 | 150 | ||
150 | Users.attachSchema(Users.schema); | 151 | Users.attachSchema(Users.schema); |
151 | 152 | ||
152 | Users.privateFields = { | 153 | Users.privateFields = { |
153 | orgId: 1, | 154 | orgId: 1, |
154 | address: 1, | 155 | address: 1, |
155 | 156 | ||
156 | firstName: 1, | 157 | firstName: 1, |
157 | lastName: 1, | 158 | lastName: 1, |
158 | emails: 1, | 159 | emails: 1, |
159 | phones: 1, | 160 | phones: 1, |
160 | 161 | ||
161 | isMetaUser: 1, | 162 | isMetaUser: 1, |
162 | createdAt: 1, | 163 | createdAt: 1, |
163 | }; | 164 | }; |
164 | 165 | ||
165 | Users.publicFields = { | 166 | Users.publicFields = { |
166 | firstName: 1, | 167 | firstName: 1, |
167 | lastName: 1, | 168 | lastName: 1, |
168 | emails: 1, | 169 | emails: 1, |
169 | 170 | ||
170 | createdAt: 1, | 171 | createdAt: 1, |
171 | }; | 172 | }; |
172 | 173 |