-
Notifications
You must be signed in to change notification settings - Fork 3
/
MobiApp.js
60 lines (51 loc) · 1.5 KB
/
MobiApp.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//Global Variables
Issues = new Mongo.Collection('issues');
// Routing
Router.onBeforeAction(function () {
if (!Meteor.userId()) {
// if the user is not logged in, render the Login template
this.render('Login');
} else {
// otherwise don't hold up the rest of hooks or our route/action function
// from running
this.next();
}
});
Router.route('/', function() {
this.render('Home');
});
Router.route('/new-issue', function () {
// render the Home template with newIssue submission
this.layout('ApplicationLayout');
this.render('newIssue');
this.render('Footer', {to: 'footer'});
});
Router.route('/issue/:_id', function() {
var issue = Issues.find({_id: this.params._id});
var current_issue = issue.fetch()[0];
this.render('Issue',{data: {current_issue: current_issue}});
this.render('Footer', {to: 'footer'});
Session.set('issue_id', this.params._id);
console.log("Router lat:"+ current_issue.lat);
Session.set('lat', current_issue.lat);
Session.set('lng', current_issue.lng);
});
// navigate to About
Router.route('/about', function () {
this.layout('ApplicationLayout');
this.render('About');
});
//navigate to submited issues
Router.route('/issues-list', function () {
this.layout('ApplicationLayout');
this.render('IssuesList');
this.render('Footer', {to: 'footer'});
});
//navigate to submited issues
Router.route('/dashboard', function () {
this.render('dashboard');
});
Router.route('/logout', function() {
AccountsTemplates.logout();
Router.go('/');
});