-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrouter.coffee
43 lines (37 loc) · 1.02 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
helper = ->
console.log @params.s
@stop
class @mainControl extends RouteController
layoutTemplate: 'layout'
waiton: ->
return Meteor.subscribe 'TestCollection'
before: ->
console.log 'should stop after this'
@stop
action: ->
@render 'main'
@render 'searchTemplate', to: 'searchYield'
console.log this
Router.map ->
@route 'something',
path: '/something'
where: 'server'
before: ->
console.log @
action: ->
@response.writeHead 200, {'Content-Type': 'text/html'}
@response.end 'hello from server!'
Router.map ->
@route 'main',
path: '/'
template: 'main'
data:
greeting: "Welcome to irtest! This is the main page. Go to search, and I'll go away because I was data pased by the 'main' route controller"
controller: 'mainControl'
@route 'search',
path: '/search/:s?'
template: 'searchTemplate'
data: -> return searchTerm: if @params.s? then @params.s else 'no search!'
before: ->
helper.call @
controller: 'mainControl'