From 08b1b1ef6dcc185c95198d7923c2efa9649dda41 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Fri, 12 Aug 2016 17:18:30 -0400 Subject: [PATCH 1/2] change routing --- hourglass/lib/router.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 hourglass/lib/router.js diff --git a/hourglass/lib/router.js b/hourglass/lib/router.js new file mode 100644 index 0000000..218a7d1 --- /dev/null +++ b/hourglass/lib/router.js @@ -0,0 +1,29 @@ +Router.route('/', function() { + if (!Meteor.userId()) { + this.redirect('/login'); + } else { + this.render("main"); + } +}); + +Router.route('/login', function() { + if (!Meteor.userId()) { + this.render("login"); + } else if (Object.keys(Meteor.user().profile).length <= 1) { + this.redirect('/profile'); + } else { + this.redirect('/'); + } +}); + +Router.route('/profile', function() { + if (!Meteor.userId()) { + this.redirect("/login"); + } else { + this.render("profile"); + } +}); + +Router.configure({ + notFoundTemplate: "NotFound" +}); From cd8d53c88705feebc7c3135121c2a8c65c0a7a22 Mon Sep 17 00:00:00 2001 From: yamanq Date: Fri, 12 Aug 2016 17:33:29 -0400 Subject: [PATCH 2/2] only display user's classes --- hourglass/client/main/main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index f4ae2fc..e0f31b1 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -104,8 +104,9 @@ Template.main.helpers({ } }, calendarOptions() { - var cursor = work.find({}); var events = []; + userclasses = Meteor.user().profile.classes; + var cursor = work.find({class: {$in: userclasses}}); cursor.forEach(function(current) { backgroundColor = calendarColors[current.type]; title = current.name;