Blame view
imports/client/views/org/admin/teachers/index.js
1.81 KB
a8c5a7fb6
|
1 2 3 4 5 6 7 8 9 10 11 |
// 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'; |
d75229d74
|
12 |
import { Teachers } from '/imports/collections/teachers/index'; |
def5858c9
|
13 |
import { TeachersView } from './TeacherView'; |
a8c5a7fb6
|
14 15 16 17 18 19 20 21 22 23 24 |
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(); |
d75229d74
|
25 26 27 28 29 30 31 32 33 34 |
teachers = Users.find({"role":"TEACHER"}).fetch() ? Users.find({"role":"TEACHER"}).fetch() : ""; teachersData = Teachers.find().fetch() ? Teachers.find().fetch() : ""; for(var i=0; i< teachers.length; i++){ for(var j=0; j< teachers.length; j++){ if(teachers[i]._id == teachersData[j].userId){ teachers[i].class = teachersData[j].class; teachers[i].dob = teachersData[j].dob; } } } |
a8c5a7fb6
|
35 36 37 |
onData(null, { data: { user: user, |
d75229d74
|
38 39 40 |
org: org, teachersData: teachersData, teachers: teachers |
a8c5a7fb6
|
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
}, }); } return () => { _.each(handles, (handle) => handle.stop() ); }; }; const reduxTick = (props, onData) => { onData(null, { data: {} }); }; export const teachersViewController = composeAll( composeWithTracker(meteorTick, Loading), compose(reduxTick, Loading), |
d75229d74
|
61 |
)(TeachersView); |