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
9 folders_show: (id) ->
\r
10 console.log(controller_name)
\r
26 names = _.map Manifest.manifest().controllers, (controller_manifest, controller_name) ->
\r
27 c = Pettanr[Pettanr.camelize(controller_name) + 'Controller']
\r
29 _.map controller_manifest.actions, (action_manifest, action_name) ->
\r
31 event_name: controller_name + '_' + action_name,
\r
32 controller: controller,
\r
33 controller_name: controller_name,
\r
34 action_manifest: action_manifest,
\r
35 action_name: action_name
\r
38 _.each _.flatten(names), (status) ->
\r
40 f = switch status.action_manifest.type
\r
42 _this[status.event_name] = () ->
\r
43 _status.controller[_status.action_name]()
\r
44 r = _status.controller_name + '/' + _status.action_name
\r
45 _this.route(r, _status.event_name)
\r
46 if _status.action_name == 'index'
\r
47 r = _status.controller_name + '/'
\r
48 _this.route(r, _status.event_name)
\r
50 _this[status.event_name] = (id) ->
\r
51 _status.controller[_status.action_name](id)
\r
52 r = _status.controller_name + '/:id/' + _status.action_name
\r
53 _this.route(r, _status.event_name)
\r
54 if _status.action_name == 'show'
\r
55 r = _status.controller_name + '/:id'
\r
56 _this.route(r, _status.event_name)
\r