-
Notifications
You must be signed in to change notification settings - Fork 8
/
router.coffee
53 lines (48 loc) · 1.33 KB
/
router.coffee
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
Router.configure
layoutTemplate: 'layout'
loadingTemplate: 'loading'
notFoundTemplate: 'notFound'
Router.map ->
@route 'itineraries',
path: '/'
data: ->
itineraries: Itineraries.find {},
sort: { created_on: 1 }
waitOn: -> [
Meteor.subscribe('itineraries')
Meteor.subscribe('headerElements')
]
onBeforeAction: ->
if Meteor.user()
return
else if Meteor.loggingIn()
@render('loading')
else
Router.go('landingPage')
@route 'landingPage', path: '/'
@route 'signUp',
path: 'sign-up'
action: ->
Session.set('openRegistrationForm', true)
Router.go('itineraries')
@route 'itinerary',
path: '/i/:_id'
data: ->
doc: Itineraries.findOne(@params._id)
elements: Elements.find { parent_id: @params._id },
sort: { position: 1 }
waitOn: -> [
Meteor.subscribe('itinerary', @params._id)
Meteor.subscribe('elements', @params._id)
]
@route 'card',
path: '/c/:_id'
data: ->
doc: Cards.findOne(@params._id)
elements: Elements.find { parent_id: @params._id },
sort: { position: 1 }
waitOn: -> [
Meteor.subscribe('card', @params._id)
Meteor.subscribe('elements', @params._id)
Meteor.subscribe('siblingElement', @params._id)
]