1 class Pettanr.Router extends Backbone.Router
\r
4 list_result = new Pettanr.Scroll.Collection({})
\r
5 new Pettanr.FilerRender('scroll', list_result, 'default', window.operators)
\r
7 show_html_format: (format) ->
\r
23 names = _.map Manifest.manifest().controllers, (controller_manifest, controller_name) ->
\r
24 c = Pettanr[Pettanr.camelize(controller_name) + 'Controller']
\r
26 _.map controller_manifest.actions, (action_manifest, action_name) ->
\r
28 event_name: controller_name + '_' + action_name,
\r
29 controller: controller,
\r
30 controller_name: controller_name,
\r
31 action_manifest: action_manifest,
\r
32 action_name: action_name
\r
35 _.each _.flatten(names), (status) ->
\r
37 switch status.action_manifest.type
\r
39 _this[status.event_name] = () ->
\r
40 _status.controller[_status.action_name]()
\r
41 r = _status.controller_name + '/' + _status.action_name
\r
42 _this.route(r, _status.event_name)
\r
43 if _status.action_name == 'index'
\r
44 r = _status.controller_name + '/'
\r
45 _this.route(r, _status.event_name)
\r
47 _this[status.event_name] = (id) ->
\r
48 _status.controller[_status.action_name](id)
\r
49 r = '^' + _status.controller_name + '\/([0-9]+)\/' + _status.action_name + '$'
\r
50 _this.route(r, _status.event_name)
\r
51 if _status.action_name == 'show'
\r
52 r = '^' + _status.controller_name + '\/([0-9]+)$'
\r
53 _this.route(///#{r}///, _status.event_name)
\r