diff --git a/imports/client/app/routes.js b/imports/client/app/routes.js index 5010602..0c75cd0 100644 --- a/imports/client/app/routes.js +++ b/imports/client/app/routes.js @@ -5,6 +5,7 @@ import { render } from 'react-dom'; import { Router, Route, IndexRoute, browserHistory } from 'react-router'; import { Meteor } from 'meteor/meteor'; +import { Users } from '/imports/collections/users/index'; /** * General Components @@ -14,9 +15,11 @@ import NotFound from '/imports/client/views/org/NotF /** * Org Components */ +import { EnterModule } from '/imports/client/views/org/enter/module/index'; -import { App } from '/imports/client/layouts/OrgApp'; -import { AppModule } from '/imports/client/views/org/app/module/Index'; + +import { AdminAppModule } from '/imports/client/views/org/admin/app/module/Index'; +import { DashboardController } from '/imports/client/views/org/admin/dashboard/index'; import { Orgs } from '/imports/collections/orgs/index'; import { importCsvController } from '/imports/client/views/org/importCsv/index' @@ -41,10 +44,10 @@ There are three types of routes 2)getInvalidOrgRoute: all the routes where someone tries to enter a subdomain which hasn't been registered yet (404 mostly :D) 3)getNonOrgRoutes: all routes linked to normal site, ie signing up a new org. CHeking out demo and everything internal **/ -const getOrgRoutes = () => ( +const getOrgAdminRoutes = () => ( - - + + @@ -54,7 +57,13 @@ const getOrgRoutes = () => ( ) - +const getOrgNonLoggedInRoutes = () => ( + + + + + +) const getInvalidOrgRoute = () => ( @@ -118,10 +127,21 @@ const detectOrg = () => { Meteor.call('checkExistingOrg', {slug:orgSlug}, function(err, res) { console.log(err); console.log(res); + if(res){ Session.set('orgId', res._id); Session.set('orgSlug', orgSlug); - render(getOrgRoutes(),document.getElementById('app')); + if(Meteor.loggingIn() || Meteor.userId()){ + userRole = _.find(res.users, {userId: Meteor.user()._id}).role; + Session.set('userRole', userRole); + if(userRole=='ADMIN'){ + render(getOrgAdminRoutes(),document.getElementById('app')); + }else{ + + } + }else{ + render(getOrgNonLoggedInRoutes(),document.getElementById('app')); + } }else{ render(getInvalidOrgRoute(),document.getElementById('app')); } diff --git a/imports/client/layouts/OrgApp.js b/imports/client/layouts/OrgApp.js deleted file mode 100644 index d2b2fb2..0000000 --- a/imports/client/layouts/OrgApp.js +++ /dev/null @@ -1,21 +0,0 @@ -import React, { Component } from 'react'; -import { Grid } from 'react-bootstrap'; -import {AppNavigationController} from '/imports/client/views/org/app/module/navigation/index'; -/** - * user based redirection will take place here - */ - export class App extends Component { - constructor(props) { - super(props); - this.state = { - - }; - }; - render(){ - return ( -
- { this.props.children } -
- ) - } - } diff --git a/imports/client/views/org/admin/AdminLayout.js b/imports/client/views/org/admin/AdminLayout.js deleted file mode 100644 index 0297a7d..0000000 --- a/imports/client/views/org/admin/AdminLayout.js +++ /dev/null @@ -1,81 +0,0 @@ -import _ from 'lodash'; -import { Meteor } from 'meteor/meteor'; -import React, { Component } from 'react'; -import { Link } from 'react-router'; -import { Avatar } from '/imports/client/components/Avatar'; -import { Icon } from '/imports/client/components/Icon'; -import classNames from 'classnames'; -import { EnterModule } from '/imports/client/views/org/enter/module/index'; -import { AdminSidebar } from './Sidebar' -import { AdminBreadcrumb } from './Breadcrumb' -// import { VerifyModule } from '/imports/client/views/verify/module/index'; -import { Navbar,Modal, Nav, NavItem, - Glyphicon, Collapse, - NavbarToggler, NavbarBrand, - NavLink, DropdownItem, DropdownToggle, DropdownMenu, - NavDropdown, MenuItem, Breadcrumb } from 'react-bootstrap'; - import { VerifyModule } from '/imports/client/views/verify/module/index' - -var Accordion = require('react-bootstrap').Accordion; -var Panel = require('react-bootstrap').Panel; -export class AdminAppLayout extends Component { - render() { - const {user, org} = this.props; - return ( -
-
-
- -
- -
-
-
-
- -
- -
-
-
Students Click to view
-
- -
-
-
-
- -
- -
-
-
Teachers Click to view
-
- -
-
-
-
- -
- -
-
-
Parents Click to view
-
- -
-
-
-
-
-
-
-
- ); - }; - -}; diff --git a/imports/client/views/org/admin/app/AdminLayout.js b/imports/client/views/org/admin/app/AdminLayout.js new file mode 100644 index 0000000..caea8e1 --- /dev/null +++ b/imports/client/views/org/admin/app/AdminLayout.js @@ -0,0 +1,84 @@ +import _ from 'lodash'; +import { Meteor } from 'meteor/meteor'; +import React, { Component } from 'react'; +import { Link } from 'react-router'; +import { Avatar } from '/imports/client/components/Avatar'; +import { Icon } from '/imports/client/components/Icon'; +import classNames from 'classnames'; +import { EnterModule } from '/imports/client/views/org/enter/module/index'; +import { AdminSidebar } from '../Sidebar' +import { AdminBreadcrumb } from '../Breadcrumb' +// import { VerifyModule } from '/imports/client/views/verify/module/index'; +import { Navbar,Modal, Nav, NavItem, + Glyphicon, Collapse, + NavbarToggler, NavbarBrand, + NavLink, DropdownItem, DropdownToggle, DropdownMenu, + NavDropdown, MenuItem, Breadcrumb } from 'react-bootstrap'; + import { VerifyModule } from '/imports/client/views/verify/module/index' + +var Accordion = require('react-bootstrap').Accordion; +var Panel = require('react-bootstrap').Panel; +export class AdminAppLayout extends Component { + render() { + const {user, org} = this.props; + return ( +
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
Students Click to view
+
+ +
+
+
+
+ +
+ +
+
+
Teachers Click to view
+
+ +
+
+
+
+ +
+ +
+
+
Parents Click to view
+
+ +
+
+
+
+
+
+
+
+
+ + ); + }; + +}; diff --git a/imports/client/views/org/admin/app/Index.js b/imports/client/views/org/admin/app/Index.js new file mode 100644 index 0000000..d50ac16 --- /dev/null +++ b/imports/client/views/org/admin/app/Index.js @@ -0,0 +1,51 @@ +// import { AppModule } from '/imports/client/views/app/module/index' +import { + composeWithTracker, + compose, + composeAll + } from 'react-komposer'; +import { AdminAppLayout } from './AdminLayout'; +import { Loading } from '/imports/client/components/Loading'; + +import { Users } from '/imports/collections/users/index'; +import { Orgs } from '/imports/collections/orgs/index'; + + +const meteorTick = (props, onData) => { + + const handles = [ + Meteor.subscribe('users.current'), + Meteor.subscribe('orgs.current'), + Meteor.subscribe('users.forMyOrg'), + Meteor.subscribe('student.forMyOrg'), + ]; + + if(_.every(handles, (handle) => (handle.ready()) )) { + const user = Users.current(); + const org = Orgs.current(); + onData(null, { + data: { + user: user, + org: org, + }, + }); + } + + return () => { + _.each(handles, (handle) => handle.stop() ); + }; +}; + + +const reduxTick = (props, onData) => { + onData(null, { + location: props.location, + data: {} + }); +}; + + +export const AdminModule = composeAll( + composeWithTracker(meteorTick, Loading), + compose(reduxTick, Loading), +)(AdminAppLayout); diff --git a/imports/client/views/org/admin/app/module/AdminAppLayout.js b/imports/client/views/org/admin/app/module/AdminAppLayout.js new file mode 100644 index 0000000..7458ef9 --- /dev/null +++ b/imports/client/views/org/admin/app/module/AdminAppLayout.js @@ -0,0 +1,66 @@ +import _ from 'lodash'; +import { Meteor } from 'meteor/meteor'; +import React, { Component } from 'react'; +import { Link } from 'react-router'; +import { Avatar } from '/imports/client/components/Avatar'; +import { Icon } from '/imports/client/components/Icon'; +import classNames from 'classnames'; +import { EnterModule } from '/imports/client/views/org/enter/module/index'; +import {AppNavigationController} from '/imports/client/views/org/admin/app/module/navigation/index'; +import { AdminSidebar } from '../../Sidebar' +import { AdminBreadcrumb } from '../../Breadcrumb' +// import { VerifyModule } from '/imports/client/views/verify/module/index'; +import { Navbar,Modal, Nav, NavItem, + Glyphicon, Collapse, + NavbarToggler, NavbarBrand, + NavLink, DropdownItem, DropdownToggle, DropdownMenu, + NavDropdown, MenuItem, Breadcrumb, Grid } + from 'react-bootstrap'; +import { VerifyModule } from '/imports/client/views/verify/module/index' +import { AdminModule } from '/imports/client/views/org/admin/app/Index' + +var Accordion = require('react-bootstrap').Accordion; +var Panel = require('react-bootstrap').Panel; +export class AdminAppLayout extends Component { + + render() { + const {user, org} = this.props.data; +if(!user.isEmailVerified()) { + return ( + + ); + }else{ + return ( +
+ +
+
+
+ +
+ +
+ { this.props.children } +
+
+
+
+
+
+ ) + return( + + ); + } + }; + +}; diff --git a/imports/client/views/org/admin/app/module/Index.js b/imports/client/views/org/admin/app/module/Index.js new file mode 100644 index 0000000..85c64c3 --- /dev/null +++ b/imports/client/views/org/admin/app/module/Index.js @@ -0,0 +1,51 @@ +// import { AppModule } from '/imports/client/views/app/module/index' +import { + composeWithTracker, + compose, + composeAll + } from 'react-komposer'; +import { AdminAppLayout } from './AdminAppLayout'; +import { Loading } from '/imports/client/components/Loading'; + +import { Users } from '/imports/collections/users/index'; +import { Orgs } from '/imports/collections/orgs/index'; + + +const meteorTick = (props, onData) => { + + const handles = [ + Meteor.subscribe('users.current'), + Meteor.subscribe('orgs.current'), + Meteor.subscribe('users.forMyOrg'), + Meteor.subscribe('student.forMyOrg'), + ]; + + if(_.every(handles, (handle) => (handle.ready()) )) { + const user = Users.current(); + const org = Orgs.current(); + onData(null, { + data: { + user: user, + org: org, + }, + }); + } + + return () => { + _.each(handles, (handle) => handle.stop() ); + }; +}; + + +const reduxTick = (props, onData) => { + onData(null, { + location: props.location, + data: {} + }); +}; + + +export const AdminAppModule = composeAll( + composeWithTracker(meteorTick, Loading), + compose(reduxTick, Loading), +)(AdminAppLayout); diff --git a/imports/client/views/org/admin/app/module/navigation/AppNavigation.js b/imports/client/views/org/admin/app/module/navigation/AppNavigation.js new file mode 100644 index 0000000..8db04f8 --- /dev/null +++ b/imports/client/views/org/admin/app/module/navigation/AppNavigation.js @@ -0,0 +1,54 @@ +import React, { Component } from 'react'; +import { Navbar } from 'react-bootstrap'; +import { Link } from 'react-router'; +import {PublicNavigation} from './PublicNavigation.js'; +import {AuthenticatedNavigation} from './AuthenticatedNavigation.js'; +// import '/imports/client/assets/css/icons/icomoon/styles.css'; +// import '/imports/client/assets/css/bootstrap.css'; +// import '/imports/client/assets/css/core.css'; +// import '/imports/client/assets/css/components.css'; +// import '/imports/client/assets/css/colors.css'; +// import '/imports/client/assets/css/colors.css'; +export class AppNavigation extends Component { + + constructor(props) { + super(props); + this.state = { + + }; + }; + + onUpdate(key, value) { + this.setState({[key]: value}); + }; + render() { + const {user} = this.props.data; + if(user){ + return( + + ) + }else{ + return( + + + + Application Name + + + + + + + + + ) + } + + return ( +
+ ); + }; + +}; diff --git a/imports/client/views/org/admin/app/module/navigation/AuthenticatedNavigation.js b/imports/client/views/org/admin/app/module/navigation/AuthenticatedNavigation.js new file mode 100644 index 0000000..d56a171 --- /dev/null +++ b/imports/client/views/org/admin/app/module/navigation/AuthenticatedNavigation.js @@ -0,0 +1,312 @@ +import React, { Component } from 'react'; +import { browserHistory } from 'react-router'; +import { LinkContainer } from 'react-router-bootstrap'; +import { logout } from '/imports/client/app/utils/loginMethods'; +import { Navbar,Modal, Nav, NavItem, + Glyphicon, Collapse, + NavbarToggler, NavbarBrand, + NavLink, DropdownItem, DropdownToggle, DropdownMenu, + NavDropdown, MenuItem } from 'react-bootstrap'; +import { Meteor } from 'meteor/meteor'; +import $ from 'jquery'; + + +const handleLogout = () => Meteor.logout(() => browserHistory.push('/login')); + +export class AuthenticatedNavigation extends Component { + constructor(props) { + super(props); + this.toggle = this.toggle.bind(this); + this.changeBodyClass = this.changeBodyClass.bind(this); + this.state = { + dropdownOpen: false, + burgerMenu: false + }; + } + toggle() { + this.setState({ + dropdownOpen: !this.state.dropdownOpen + }); + } + changeBodyClass(){ + if(this.state.burgerMenu){ + $('body').addClass('sidebar-xs'); + this.setState({burgerMenu: false}); + }else{ + $('body').removeClass('sidebar-xs'); + this.setState({burgerMenu: true}); + } + } + render(){ + const {user, org} = this.props.data; + return( + + + + + +   YoungDesk + + +
    +
  • +
  • +
+ +
+ +
    + + + + + +
    +
    + Git updates +
      +
    • +
    + +
    +
      +
    • +
      + +
      + +
      + Drop the IE specific hacks for temporal inputs +
      4 minutes ago
      +
      +
    • + +
    • +
      + +
      + +
      + Add full font overrides for popovers and tooltips +
      36 minutes ago
      +
      +
    • + +
    • +
      + +
      + +
      + Chris Arney created a new Design branch +
      2 hours ago
      +
      +
    • + +
    • +
      + +
      + +
      + Eugene Kopyov merged Master and Dev branches +
      Dec 18, 18:36
      +
      +
    • + +
    • +
      + +
      + +
      + Have Carousel ignore keyboard events +
      Dec 12, 05:46
      +
      +
    • +
    +
    + +
    +
    +
    +
+
+

Hello {user.getFullName()}

+

logout()} + > + logout +

+ +
+
+
+ ); + } +} diff --git a/imports/client/views/org/admin/app/module/navigation/AuthenticatedNavigation0.js b/imports/client/views/org/admin/app/module/navigation/AuthenticatedNavigation0.js new file mode 100644 index 0000000..c9f37b6 --- /dev/null +++ b/imports/client/views/org/admin/app/module/navigation/AuthenticatedNavigation0.js @@ -0,0 +1,303 @@ +import React, { Component } from 'react'; +import { browserHistory } from 'react-router'; +import { LinkContainer } from 'react-router-bootstrap'; +import { Nav, NavItem, + NavDropdown, MenuItem } from 'react-bootstrap'; +import { Meteor } from 'meteor/meteor'; + +const handleLogout = () => Meteor.logout(() => browserHistory.push('/login')); + +export class AuthenticatedNavigation extends Component { + constructor(props) { + super(props); + this.state = { + + }; + }; +render(){ + const {user} = this.props.data; + return( +
+
+
+ + YOUNGDESK + + +
    +
  • +
  • +
+
+ + +
+
+); +} +} diff --git a/imports/client/views/org/admin/app/module/navigation/Loading.js b/imports/client/views/org/admin/app/module/navigation/Loading.js new file mode 100644 index 0000000..c97a7eb --- /dev/null +++ b/imports/client/views/org/admin/app/module/navigation/Loading.js @@ -0,0 +1,30 @@ +import React from 'react'; + +const Loading = () => ( + + + + + +); + +export default Loading; diff --git a/imports/client/views/org/admin/app/module/navigation/PublicNavigation.js b/imports/client/views/org/admin/app/module/navigation/PublicNavigation.js new file mode 100644 index 0000000..acfc745 --- /dev/null +++ b/imports/client/views/org/admin/app/module/navigation/PublicNavigation.js @@ -0,0 +1,27 @@ +import React, { Component } from 'react'; +import { LinkContainer } from 'react-router-bootstrap'; +import { setQueryParam } from '/imports/client/app/utils/setQueryParam'; +import { browserHistory } from 'react-router'; +import { Nav, NavItem } from 'react-bootstrap'; + + +export class PublicNavigation extends Component { + constructor(props) { + super(props); + this.state = { + + }; + }; +render(){ + console.log(this.props); + var mainSite = document.location.hostname.split( "." )[1]; + var signup = `http://${mainSite}/signup`; + return( + + ) +} +} diff --git a/imports/client/views/org/admin/app/module/navigation/index.js b/imports/client/views/org/admin/app/module/navigation/index.js new file mode 100644 index 0000000..fbfa4d7 --- /dev/null +++ b/imports/client/views/org/admin/app/module/navigation/index.js @@ -0,0 +1,49 @@ +// import { InviteSignupController } from '/imports/client/views/invite/signup/index' +import _ from 'lodash'; +import { + composeWithTracker, + compose, + composeAll + } from 'react-komposer'; +import { Loading } from '/imports/client/components/Loading'; + +import { Orgs } from '/imports/collections/orgs/index'; +import { Users } from '/imports/collections/users/index'; + +import { AppNavigation } from './AppNavigation'; + +const meteorTick = (props, onData) => { + + const handles = [ + Meteor.subscribe('users.current'), + Meteor.subscribe('orgs.current') + ]; + + if(_.every(handles, (handle) => (handle.ready()) )) { + const user = Users.current(); + const org = Orgs.current(); + onData(null, { + data: { + user: user, + org: org + }, + }); + } + + return () => { + _.each(handles, (handle) => handle.stop() ); + }; +}; + + +const reduxTick = (props, onData) => { + onData(null, { + data: {} + }); +}; + + +export const AppNavigationController = composeAll( + composeWithTracker(meteorTick, Loading), + compose(reduxTick, Loading), +)(AppNavigation); diff --git a/imports/client/views/org/admin/dashboard/dashboard.js b/imports/client/views/org/admin/dashboard/dashboard.js new file mode 100644 index 0000000..6ff56b9 --- /dev/null +++ b/imports/client/views/org/admin/dashboard/dashboard.js @@ -0,0 +1,33 @@ +import _ from 'lodash'; +import { Meteor } from 'meteor/meteor'; + +import React, { Component } from 'react'; +import { Link,browserHistory } from 'react-router'; +import { FormGroup, + FormControl,Glyphicon,Button } from 'react-bootstrap'; + + +export class DashboardView extends Component { + + constructor(props) { + super(props); + this.state = { + + }; + this.onUpdate = this.onUpdate.bind(this); + }; + + onUpdate(key, value) { + this.setState({[key]: value}); + }; + + render() { + const {user, org} = this.props.data; + return ( +
+

Dashboard

+
+ ); + }; + +}; diff --git a/imports/client/views/org/admin/dashboard/index.js b/imports/client/views/org/admin/dashboard/index.js new file mode 100644 index 0000000..4412051 --- /dev/null +++ b/imports/client/views/org/admin/dashboard/index.js @@ -0,0 +1,48 @@ +// import { InviteSignupController } from '/imports/client/views/invite/signup/index' +import _ from 'lodash'; +import { + composeWithTracker, + compose, + composeAll + } from 'react-komposer'; +import { Loading } from '/imports/client/components/Loading'; + +import { Orgs } from '/imports/collections/orgs/index'; +import { Users } from '/imports/collections/users/index'; +import { DashboardView } from './dashboard'; + +const meteorTick = (props, onData) => { + + const handles = [ + Meteor.subscribe('users.current'), + Meteor.subscribe('orgs.current') + ]; + + if(_.every(handles, (handle) => (handle.ready()) )) { + const user = Users.current(); + const org = Orgs.current(); + onData(null, { + data: { + user: user, + org: org + }, + }); + } + + return () => { + _.each(handles, (handle) => handle.stop() ); + }; +}; + + +const reduxTick = (props, onData) => { + onData(null, { + data: {} + }); +}; + + +export const DashboardController = composeAll( + composeWithTracker(meteorTick, Loading), + compose(reduxTick, Loading), +)(DashboardView); diff --git a/imports/client/views/org/admin/parents/parentsview.js b/imports/client/views/org/admin/parents/parentsview.js index f0b3c82..e025340 100644 --- a/imports/client/views/org/admin/parents/parentsview.js +++ b/imports/client/views/org/admin/parents/parentsview.js @@ -31,33 +31,17 @@ export class ParentsView extends Component { render() { const {user, org, parent} = this.props.data; return ( -
-
-
- +
+ -
- - -
-
-
- - {/* - */} -
-
-
-
-
+ {/* + */}
); }; diff --git a/imports/client/views/org/admin/staff/StaffView.js b/imports/client/views/org/admin/staff/StaffView.js index 46041b8..47c73b8 100644 --- a/imports/client/views/org/admin/staff/StaffView.js +++ b/imports/client/views/org/admin/staff/StaffView.js @@ -6,8 +6,6 @@ import { Link,browserHistory } from 'react-router'; import { FormGroup, FormControl,Glyphicon,Button } from 'react-bootstrap'; import { Header } from '../Header'; -import { AdminSidebar } from '../Sidebar' -import { AdminBreadcrumb } from '../Breadcrumb' import { StaffTable } from './view/StaffTable' import { AddStaff } from './add/addStaff' import { UploadCsvStaff } from './UploadCsvStaff' @@ -28,32 +26,17 @@ export class StaffView extends Component { render() { const {user, org, staff} = this.props.data; return ( -
-
-
- -
- -
-
-
- - - -
-
-
-
-
+
+
+ + +
); }; diff --git a/imports/client/views/org/admin/students/StudentView.js b/imports/client/views/org/admin/students/StudentView.js index 95f8a94..8c07979 100644 --- a/imports/client/views/org/admin/students/StudentView.js +++ b/imports/client/views/org/admin/students/StudentView.js @@ -10,8 +10,6 @@ import { Navbar,Modal, Nav, NavItem, NavDropdown, MenuItem, Breadcrumb, Button } from 'react-bootstrap'; import { StudentTable } from './view/StudentTable'; import { Header } from '../Header'; -import { AdminSidebar } from '../Sidebar' -import { AdminBreadcrumb } from '../Breadcrumb' import { UploadCsv } from './UploadCsv'; import { AddStudent } from './add/addStudent'; import { Students } from '/imports/collections/students/index'; @@ -51,35 +49,17 @@ export class StudentView extends Component { } }); return ( -
-
-
- - {/*end sidebar*/} -
- - {/*content*/} - -
-
-
-
- - - -
-
-
-
-
-
-
+
+
+
+ + + +
+
); }; diff --git a/imports/client/views/org/app/module/AdminAppLayout.js b/imports/client/views/org/app/module/AdminAppLayout.js new file mode 100644 index 0000000..f9f16ec --- /dev/null +++ b/imports/client/views/org/app/module/AdminAppLayout.js @@ -0,0 +1,52 @@ +import _ from 'lodash'; +import { Meteor } from 'meteor/meteor'; +import React, { Component } from 'react'; +import { Link } from 'react-router'; +import { Avatar } from '/imports/client/components/Avatar'; +import { Icon } from '/imports/client/components/Icon'; +import classNames from 'classnames'; +import { EnterModule } from '/imports/client/views/org/enter/module/index'; +// import { VerifyModule } from '/imports/client/views/verify/module/index'; +import { Navbar,Modal, Nav, NavItem, + Glyphicon, Collapse, + NavbarToggler, NavbarBrand, + NavLink, DropdownItem, DropdownToggle, DropdownMenu, + NavDropdown, MenuItem, Breadcrumb } from 'react-bootstrap'; +import { VerifyModule } from '/imports/client/views/verify/module/index' +import { AdminModule } from '/imports/client/views/org/admin/app/Index' + +var Accordion = require('react-bootstrap').Accordion; +var Panel = require('react-bootstrap').Panel; +export class AdminAppLayout extends Component { + + render() { + const {user, org} = this.props.data; + if(!user) { + return ( + + ); + }else if(!user.isEmailVerified()) { + return ( + + ); + }else if(user.role==='ADMIN'){ + return( + + ); + }else{ + return ( + null + ); + } + }; + +}; diff --git a/imports/client/views/org/app/module/AppLayout.js b/imports/client/views/org/app/module/AppLayout.js deleted file mode 100644 index 94d9cb0..0000000 --- a/imports/client/views/org/app/module/AppLayout.js +++ /dev/null @@ -1,52 +0,0 @@ -import _ from 'lodash'; -import { Meteor } from 'meteor/meteor'; -import React, { Component } from 'react'; -import { Link } from 'react-router'; -import { Avatar } from '/imports/client/components/Avatar'; -import { Icon } from '/imports/client/components/Icon'; -import classNames from 'classnames'; -import { EnterModule } from '/imports/client/views/org/enter/module/index'; -// import { VerifyModule } from '/imports/client/views/verify/module/index'; -import { Navbar,Modal, Nav, NavItem, - Glyphicon, Collapse, - NavbarToggler, NavbarBrand, - NavLink, DropdownItem, DropdownToggle, DropdownMenu, - NavDropdown, MenuItem, Breadcrumb } from 'react-bootstrap'; -import { VerifyModule } from '/imports/client/views/verify/module/index' -import { AdminAppLayout } from '/imports/client/views/org/admin/AdminLayout' - -var Accordion = require('react-bootstrap').Accordion; -var Panel = require('react-bootstrap').Panel; -export class AppLayout extends Component { - - render() { - const {user, org} = this.props.data; - if(!user) { - return ( - - ); - }else if(!user.isEmailVerified()) { - return ( - - ); - }else if(user.role==='ADMIN'){ - return( - - ); - }else{ - return ( - null - ); - } - }; - -}; diff --git a/imports/client/views/org/app/module/Index.js b/imports/client/views/org/app/module/Index.js index f60fc87..85c64c3 100644 --- a/imports/client/views/org/app/module/Index.js +++ b/imports/client/views/org/app/module/Index.js @@ -4,7 +4,7 @@ import { compose, composeAll } from 'react-komposer'; -import { AppLayout } from './AppLayout'; +import { AdminAppLayout } from './AdminAppLayout'; import { Loading } from '/imports/client/components/Loading'; import { Users } from '/imports/collections/users/index'; @@ -45,7 +45,7 @@ const reduxTick = (props, onData) => { }; -export const AppModule = composeAll( +export const AdminAppModule = composeAll( composeWithTracker(meteorTick, Loading), compose(reduxTick, Loading), -)(AppLayout); +)(AdminAppLayout); diff --git a/imports/client/views/org/app/module/navigation/AppNavigation.js b/imports/client/views/org/app/module/navigation/AppNavigation.js deleted file mode 100644 index 8db04f8..0000000 --- a/imports/client/views/org/app/module/navigation/AppNavigation.js +++ /dev/null @@ -1,54 +0,0 @@ -import React, { Component } from 'react'; -import { Navbar } from 'react-bootstrap'; -import { Link } from 'react-router'; -import {PublicNavigation} from './PublicNavigation.js'; -import {AuthenticatedNavigation} from './AuthenticatedNavigation.js'; -// import '/imports/client/assets/css/icons/icomoon/styles.css'; -// import '/imports/client/assets/css/bootstrap.css'; -// import '/imports/client/assets/css/core.css'; -// import '/imports/client/assets/css/components.css'; -// import '/imports/client/assets/css/colors.css'; -// import '/imports/client/assets/css/colors.css'; -export class AppNavigation extends Component { - - constructor(props) { - super(props); - this.state = { - - }; - }; - - onUpdate(key, value) { - this.setState({[key]: value}); - }; - render() { - const {user} = this.props.data; - if(user){ - return( - - ) - }else{ - return( - - - - Application Name - - - - - - - - - ) - } - - return ( -
- ); - }; - -}; diff --git a/imports/client/views/org/app/module/navigation/AuthenticatedNavigation.js b/imports/client/views/org/app/module/navigation/AuthenticatedNavigation.js deleted file mode 100644 index d56a171..0000000 --- a/imports/client/views/org/app/module/navigation/AuthenticatedNavigation.js +++ /dev/null @@ -1,312 +0,0 @@ -import React, { Component } from 'react'; -import { browserHistory } from 'react-router'; -import { LinkContainer } from 'react-router-bootstrap'; -import { logout } from '/imports/client/app/utils/loginMethods'; -import { Navbar,Modal, Nav, NavItem, - Glyphicon, Collapse, - NavbarToggler, NavbarBrand, - NavLink, DropdownItem, DropdownToggle, DropdownMenu, - NavDropdown, MenuItem } from 'react-bootstrap'; -import { Meteor } from 'meteor/meteor'; -import $ from 'jquery'; - - -const handleLogout = () => Meteor.logout(() => browserHistory.push('/login')); - -export class AuthenticatedNavigation extends Component { - constructor(props) { - super(props); - this.toggle = this.toggle.bind(this); - this.changeBodyClass = this.changeBodyClass.bind(this); - this.state = { - dropdownOpen: false, - burgerMenu: false - }; - } - toggle() { - this.setState({ - dropdownOpen: !this.state.dropdownOpen - }); - } - changeBodyClass(){ - if(this.state.burgerMenu){ - $('body').addClass('sidebar-xs'); - this.setState({burgerMenu: false}); - }else{ - $('body').removeClass('sidebar-xs'); - this.setState({burgerMenu: true}); - } - } - render(){ - const {user, org} = this.props.data; - return( - - - - - -   YoungDesk - - -
    -
  • -
  • -
- -
- -
    - - - - - -
    -
    - Git updates -
      -
    • -
    - -
    -
      -
    • -
      - -
      - -
      - Drop the IE specific hacks for temporal inputs -
      4 minutes ago
      -
      -
    • - -
    • -
      - -
      - -
      - Add full font overrides for popovers and tooltips -
      36 minutes ago
      -
      -
    • - -
    • -
      - -
      - -
      - Chris Arney created a new Design branch -
      2 hours ago
      -
      -
    • - -
    • -
      - -
      - -
      - Eugene Kopyov merged Master and Dev branches -
      Dec 18, 18:36
      -
      -
    • - -
    • -
      - -
      - -
      - Have Carousel ignore keyboard events -
      Dec 12, 05:46
      -
      -
    • -
    -
    - -
    -
    -
    -
-
-

Hello {user.getFullName()}

-

logout()} - > - logout -

- -
-
-
- ); - } -} diff --git a/imports/client/views/org/app/module/navigation/AuthenticatedNavigation0.js b/imports/client/views/org/app/module/navigation/AuthenticatedNavigation0.js deleted file mode 100644 index c9f37b6..0000000 --- a/imports/client/views/org/app/module/navigation/AuthenticatedNavigation0.js +++ /dev/null @@ -1,303 +0,0 @@ -import React, { Component } from 'react'; -import { browserHistory } from 'react-router'; -import { LinkContainer } from 'react-router-bootstrap'; -import { Nav, NavItem, - NavDropdown, MenuItem } from 'react-bootstrap'; -import { Meteor } from 'meteor/meteor'; - -const handleLogout = () => Meteor.logout(() => browserHistory.push('/login')); - -export class AuthenticatedNavigation extends Component { - constructor(props) { - super(props); - this.state = { - - }; - }; -render(){ - const {user} = this.props.data; - return( -
-
-
- - YOUNGDESK - - -
    -
  • -
  • -
-
- - -
-
-); -} -} diff --git a/imports/client/views/org/app/module/navigation/Loading.js b/imports/client/views/org/app/module/navigation/Loading.js deleted file mode 100644 index c97a7eb..0000000 --- a/imports/client/views/org/app/module/navigation/Loading.js +++ /dev/null @@ -1,30 +0,0 @@ -import React from 'react'; - -const Loading = () => ( - - - - - -); - -export default Loading; diff --git a/imports/client/views/org/app/module/navigation/PublicNavigation.js b/imports/client/views/org/app/module/navigation/PublicNavigation.js deleted file mode 100644 index acfc745..0000000 --- a/imports/client/views/org/app/module/navigation/PublicNavigation.js +++ /dev/null @@ -1,27 +0,0 @@ -import React, { Component } from 'react'; -import { LinkContainer } from 'react-router-bootstrap'; -import { setQueryParam } from '/imports/client/app/utils/setQueryParam'; -import { browserHistory } from 'react-router'; -import { Nav, NavItem } from 'react-bootstrap'; - - -export class PublicNavigation extends Component { - constructor(props) { - super(props); - this.state = { - - }; - }; -render(){ - console.log(this.props); - var mainSite = document.location.hostname.split( "." )[1]; - var signup = `http://${mainSite}/signup`; - return( - - ) -} -} diff --git a/imports/client/views/org/app/module/navigation/index.js b/imports/client/views/org/app/module/navigation/index.js deleted file mode 100644 index fbfa4d7..0000000 --- a/imports/client/views/org/app/module/navigation/index.js +++ /dev/null @@ -1,49 +0,0 @@ -// import { InviteSignupController } from '/imports/client/views/invite/signup/index' -import _ from 'lodash'; -import { - composeWithTracker, - compose, - composeAll - } from 'react-komposer'; -import { Loading } from '/imports/client/components/Loading'; - -import { Orgs } from '/imports/collections/orgs/index'; -import { Users } from '/imports/collections/users/index'; - -import { AppNavigation } from './AppNavigation'; - -const meteorTick = (props, onData) => { - - const handles = [ - Meteor.subscribe('users.current'), - Meteor.subscribe('orgs.current') - ]; - - if(_.every(handles, (handle) => (handle.ready()) )) { - const user = Users.current(); - const org = Orgs.current(); - onData(null, { - data: { - user: user, - org: org - }, - }); - } - - return () => { - _.each(handles, (handle) => handle.stop() ); - }; -}; - - -const reduxTick = (props, onData) => { - onData(null, { - data: {} - }); -}; - - -export const AppNavigationController = composeAll( - composeWithTracker(meteorTick, Loading), - compose(reduxTick, Loading), -)(AppNavigation); diff --git a/imports/collections/users/index.js b/imports/collections/users/index.js index 39c27f9..36271bc 100644 --- a/imports/collections/users/index.js +++ b/imports/collections/users/index.js @@ -27,6 +27,7 @@ class User { }; getRole() { + return (this._id); const org = Orgs.findOne({_id: this.orgId}); if(!org) return null; const connection = _.find(org.users, {userId: this._id});