forked from mcknightg/flutterbum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.js
104 lines (99 loc) · 2.46 KB
/
routes.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
Router.map(function() {
this.route('home', {
path: '/',
layoutTemplate:'nosidebar'
});
this.route('customers', {
path: '/customers',
layoutTemplate:'mainLayout',
loginRequired: 'entrySignIn',
waitOn:function(){
return Meteor.subscribe('customers');
},
data:{
'customers':function(){
return Customers.find({});
}
},
onAfterAction: function() {
SEO.set({
title: 'Customers | ' + SEO.settings.title
});
}
});
this.route('archives', {
layoutTemplate: 'mainLayout',
path: '/archives',
loginRequired: 'entrySignIn',
waitOn: function () {
Meteor.subscribe('archives', Session.get('active_project'));
}
});
this.route('roles', {
path: '/roles',
layoutTemplate:'mainLayout',
loginRequired: 'entrySignIn',
waitOn:function(){
return Meteor.subscribe('directory');
}
});
this.route('dashboard', {
path: '/dashboard',
layoutTemplate:'mainLayout',
loginRequired: 'entrySignIn',
waitOn:function(){
Meteor.subscribe('customers');
Meteor.subscribe('chats');
return Meteor.subscribe('projects',Meteor.userId());
},
data:{
'projects':function(){
return Projects.find();
}
},
onAfterAction: function() {
// SEO.set({
// title: 'Dashboard | ' + SEO.settings.title
// });
}
});
this.route('projectView',{
path:'/projects/:id',
layoutTemplate:'mainLayout',
loginRequired:'entrySignIn',
waitOn:function(){
Meteor.subscribe('customers');
Meteor.subscribe('conversations',this.params.id);
Meteor.subscribe('todos',this.params.id);
Meteor.subscribe('calevents',this.params.id);
Meteor.subscribe('uploads',this.params.id);
Meteor.subscribe('directory');
Meteor.subscribe('chats');
return Meteor.subscribe('projects');
},
data:function(){
Session.set('active_project',this.params.id);
return Projects.findOne({_id:this.params.id});
},
onAfterAction:function(){
SEO.set({
title:'Project View | ' + SEO.settings.title
})
}
});
this.route('profile', {
path: '/profile',
layoutTemplate:'nosidebar',
data: function() {
return Meteor.user();
}
});
this.route('notFound', {
path: '*',
where: 'server',
action: function() {
this.response.statusCode = 404;
this.response.end(Handlebars.templates['404']());
}
});
});