class Pettanr.Router extends Backbone.Router\r
\r
- _index: () ->\r
- list_result = new Pettanr.Scroll.Collection({})\r
- new Pettanr.FilerRender('scroll', list_result, 'default', window.operators)\r
- \r
- show_html_format: (format) -> \r
- \r
- count: () ->\r
- \r
- new: () ->\r
- \r
- edit: () ->\r
- \r
- create: () ->\r
- \r
- update: () ->\r
- \r
- destroy: () ->\r
- \r
parse_query_string: (query_string) ->\r
params = {}\r
if query_string\r
fire: (params) ->\r
c = Pettanr[Pettanr.camelize(params['controller']) + 'Controller']\r
controller = new c\r
- controller[params['action']](params)\r
+ controller.params = params\r
+ controller[params['action']]()\r
\r
initialize: () ->\r
this['c_i_a'] = (controller, id, action, query_string) ->\r
params['action'] = 'show'\r
params['id'] = id\r
else\r
- params['action'] = 'index'\r
+ if id\r
+ params['action'] = id\r
+ else\r
+ params['action'] = 'index'\r
this.fire(params)\r
+ this['c'] = (controller, query_string) ->\r
+ params = this.parse_query_string(query_string)\r
+ params['controller'] = controller\r
+ params['format'] = 'html'\r
+ params['action'] = 'index'\r
+ this.fire(params)\r
+ this.route('', 'home')\r
this.route(':controller/:id/:action?*query_string', 'c_i_a')\r
this.route(':controller/:id/:action', 'c_i_a')\r
this.route(':controller/:id?*query_string', 'c_i')\r
this.route(':controller/:id', 'c_i')\r
+ this.route(':controller?*query_string', 'c')\r
+ this.route(':controller', 'c')\r
+ \r
+ home: () ->\r
+ params = {}\r
+ params['controller'] = 'folders'\r
+ params['action'] = 'root'\r
+ @fire(params)\r
\r
hoge: () ->\r
names = _.map Manifest.manifest().controllers, (controller_manifest, controller_name) ->\r