Commit c6b4fc634c3680db5d46f22a12a19455f3b0ff43

Authored by Deepak
1 parent af71e7fcd5
Exists in master

added students publication

imports/client/views/org/admin/students/StudentTable.js
... ... @@ -38,7 +38,7 @@ export class StudentTable extends Component {
38 38 <tr>
39 39 <th>First Name</th>
40 40 <th>Last Name</th>
41   - <th>className</th>
  41 + <th>Class</th>
42 42 <th>DOB</th>
43 43 <th>Status</th>
44 44 <th className="text-center">Actions</th>
... ...
imports/client/views/org/admin/students/StudentView.js
... ... @@ -41,10 +41,8 @@ export class StudentView extends Component {
41 41 render() {
42 42 firstNameSearch = this.state.firstNameSearch;
43 43 var students =_.filter(this.props.data.students,function(item){
44   - console.log(item);
45 44 return _.includes(item.firstName.toLowerCase(),firstNameSearch.toLowerCase());
46 45 });
47   - console.log(students);
48 46 return (
49 47 <div className="content has-detached-left">
50 48 <div className="container-detached">
... ...
imports/client/views/org/admin/students/index.js
... ... @@ -10,7 +10,7 @@ import { Loading } from &#39;/imports/client/components/Loadi
10 10 import { Orgs } from '/imports/collections/orgs/index';
11 11 import { Users } from '/imports/collections/users/index';
12 12 import { StudentView } from './StudentView';
13   -import { Students } from '/imports/collections/students/methods'
  13 +import { Students } from '/imports/collections/students/index';
14 14  
15 15  
16 16 const meteorTick = (props, onData) => {
... ... @@ -18,13 +18,17 @@ const meteorTick = (props, onData) =&gt; {
18 18 const handles = [
19 19 Meteor.subscribe('users.current'),
20 20 Meteor.subscribe('orgs.current'),
21   - Meteor.subscribe('users.forMyOrg')
  21 + Meteor.subscribe('users.forMyOrg'),
  22 + Meteor.subscribe('student.forMyOrg'),
22 23 ];
23 24  
24 25 if(_.every(handles, (handle) => (handle.ready()) )) {
25 26 const user = Users.current();
26 27 const org = Orgs.current();
27 28 const students = Users.find({"role":"STUDENT"}).fetch();
  29 + const StudentData = Students.find().fetch();
  30 + console.log("StudentData");
  31 + console.log(StudentData);
28 32 onData(null, {
29 33 data: {
30 34 user: user,
... ...
imports/collections/students/publications.js
... ... @@ -0,0 +1,12 @@
  1 +import { Meteor } from 'meteor/meteor';
  2 +import { check, Match } from 'meteor/check'
  3 +
  4 +import { Orgs } from '/imports/collections/orgs/index';
  5 +import { Users } from '/imports/collections/users/index';
  6 +import { Students } from '/imports/collections/students/index';
  7 +
  8 +Meteor.publish('student.forMyOrg', function () {
  9 + const user = Users.findOne({_id: this.userId});
  10 + if(!user) return [];
  11 + return Students.find({orgId: user.orgId});
  12 +});
... ...
imports/server/collections.js
... ... @@ -4,3 +4,4 @@ import &#39;/imports/collections/orgs/methods&#39;;
4 4 import '/imports/collections/users/publications';
5 5  
6 6 import '/imports/collections/students/methods';
  7 +import '/imports/collections/students/publications';
... ...