-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.js
65 lines (57 loc) · 1.24 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
Router.configure({
layoutTemplate: 'layout',
yieldTemplates: {
'header': {to: 'header'},
'footer': {to: 'footer'}
},
loadingTemplate: 'loading',
notFoundTemplate: '404',
waitOn: function (){
return [
Meteor.subscribe("Users")
];
},
data: function(){
},
action: function () {
}
});
/* https://github.com/EventedMind/iron-router/issues/554 */
Router.onBeforeAction('loading');
Router.map(function () {
this.route('home', {
path: '/',
onBeforeAction: function(){
Session.set('routeName', 'Home');
$('body').scrollTop(0);
this.next();
}
});
this.route('profile', {
path: '/profile',
});
this.route('project', {
path: 'project/:_projectName?',
template: 'project',
data: function(){
Session.set('projectName', this.params._projectName);
return {
projectName: this.params._projectName
};
},
onBeforeAction: function(){
Session.set('routeName', 'Projects');
$('body').scrollTop(0);
this.next();
}
});
this.route('admin', {
path: '/admin',
onBeforeAction: function() {
if (!AuthManager.userIsInRole(Meteor.userId(), ['admin'])) {
Router.go("/");
}
this.next();
}
});
});