From cdd2cd99ab7e45f4f60f4f1a9b281691788b67b8 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Fri, 12 Aug 2016 20:42:29 -0400 Subject: [PATCH] publish and subscribe --- hourglass/.meteor/packages | 1 - hourglass/.meteor/versions | 1 - hourglass/client/main/main.js | 4 +++- hourglass/client/profile/profile.js | 5 +++++ hourglass/collections/main.js | 4 +--- hourglass/server/main.js | 8 ++++---- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/hourglass/.meteor/packages b/hourglass/.meteor/packages index 0a3f2a6..5d82008 100644 --- a/hourglass/.meteor/packages +++ b/hourglass/.meteor/packages @@ -17,7 +17,6 @@ standard-minifier-js@1.1.8 # JS minifier run for production mode es5-shim@4.6.13 # ECMAScript 5 compatibility for older browsers. ecmascript@0.5.7 # Enable ECMAScript2015+ syntax in app code -autopublish@1.0.7 # Publish all data to the clients (for prototyping) insecure@1.0.7 # Allow all DB writes from clients (for prototyping) fortawesome:fontawesome session diff --git a/hourglass/.meteor/versions b/hourglass/.meteor/versions index b10c120..7358744 100644 --- a/hourglass/.meteor/versions +++ b/hourglass/.meteor/versions @@ -6,7 +6,6 @@ accounts-ui-unstyled@1.1.12 alanning:roles@1.2.15 aldeed:simple-schema@1.5.3 allow-deny@1.0.5 -autopublish@1.0.7 autoupdate@1.2.11 babel-compiler@6.9.0 babel-runtime@0.1.10 diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index 8e54e52..17ff0ae 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -4,7 +4,9 @@ import { import './main.html'; - +Meteor.subscribe('schools'); +Meteor.subscribe('classes'); +Meteor.subscribe('work'); var openValues = { "menu": "-25%", "options": "-20%" diff --git a/hourglass/client/profile/profile.js b/hourglass/client/profile/profile.js index 26bad1a..8939454 100644 --- a/hourglass/client/profile/profile.js +++ b/hourglass/client/profile/profile.js @@ -2,6 +2,11 @@ import { Template } from 'meteor/templating'; + +Meteor.subscribe('schools'); +Meteor.subscribe('classes'); +Meteor.subscribe('work'); + Session.set("profInputOpen", null); Session.set("profClassTab", "manClass"); Session.set("modifying", null); diff --git a/hourglass/collections/main.js b/hourglass/collections/main.js index f6b3959..fca665f 100644 --- a/hourglass/collections/main.js +++ b/hourglass/collections/main.js @@ -6,7 +6,6 @@ schools.schema = new SimpleSchema({ name: {type: String}, status: {type: Boolean}, creator: {type: String}, - aliases: {type: [String]} }); classes.schema = new SimpleSchema({ @@ -30,7 +29,6 @@ work.schema = new SimpleSchema({ name: {type: String}, class: {type: String}, dueDate: {type: Date}, - aliases: {type: [String], optional: true}, submittor: {type: String, optional: true}, confirmations: {type: [String], optional: true}, reports: {type: [String], optional: true}, @@ -38,4 +36,4 @@ work.schema = new SimpleSchema({ done: {type: [String], optional: true}, numberdone: {type: Number, optional: true}, type: {type: String} -}); \ No newline at end of file +}); diff --git a/hourglass/server/main.js b/hourglass/server/main.js index 680563d..bd7031b 100644 --- a/hourglass/server/main.js +++ b/hourglass/server/main.js @@ -32,7 +32,7 @@ Meteor.publish('schools', function() { }); Meteor.publish('classes', function() { - if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) { + if (Roles.userIsInRole(this.userId, ['superadmin', 'admin'])) { return classes.find(); } else { return classes.find({ @@ -40,7 +40,7 @@ Meteor.publish('classes', function() { privacy: false }, { _id: { - $in: Meteor.user().profile.classes + $in: this.user().profile.classes } }] }, { @@ -63,12 +63,12 @@ Meteor.publish('classes', function() { }); Meteor.publish('work', function() { - if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) { + if (Roles.userIsInRole(this.userId, ['superadmin', 'admin'])) { return work.find(); } else { return work.find({ class: { - $in: Meteor.user().profile.classes + $in: this.user().profile.classes } }); }