2007-01-22 14:43:50 +01:00
|
|
|
# Create a route to DEFAULT_WEB, if such is specified; also register a generic route
|
|
|
|
def connect_to_web(map, generic_path, generic_routing_options)
|
|
|
|
if defined? DEFAULT_WEB
|
|
|
|
explicit_path = generic_path.gsub(/:web\/?/, '')
|
|
|
|
explicit_routing_options = generic_routing_options.merge(:web => DEFAULT_WEB)
|
|
|
|
map.connect(explicit_path, explicit_routing_options)
|
|
|
|
end
|
|
|
|
map.connect(generic_path, generic_routing_options)
|
|
|
|
end
|
|
|
|
|
2010-01-27 04:53:37 +01:00
|
|
|
# :id's can be arbitrary junk
|
|
|
|
id_regexp = /.+/
|
|
|
|
|
2007-01-22 14:43:50 +01:00
|
|
|
ActionController::Routing::Routes.draw do |map|
|
|
|
|
map.connect 'create_system', :controller => 'admin', :action => 'create_system'
|
|
|
|
map.connect 'create_web', :controller => 'admin', :action => 'create_web'
|
|
|
|
map.connect 'delete_web', :controller => 'admin', :action => 'delete_web'
|
2008-12-31 10:54:23 +01:00
|
|
|
map.connect 'delete_files', :controller => 'admin', :action => 'delete_files'
|
2007-01-22 14:43:50 +01:00
|
|
|
map.connect 'web_list', :controller => 'wiki', :action => 'web_list'
|
|
|
|
|
|
|
|
connect_to_web map, ':web/edit_web', :controller => 'admin', :action => 'edit_web'
|
2008-05-04 02:02:56 +02:00
|
|
|
connect_to_web map, ':web/remove_orphaned_pages', :controller => 'admin', :action => 'remove_orphaned_pages'
|
2008-12-06 23:11:47 +01:00
|
|
|
connect_to_web map, ':web/remove_orphaned_pages_in_category', :controller => 'admin', :action => 'remove_orphaned_pages_in_category'
|
2008-12-30 10:03:02 +01:00
|
|
|
connect_to_web map, ':web/file/delete/:id', :controller => 'file', :action => 'delete', :requirements => {:id => /[-._\w]+/}, :id => nil
|
2009-01-27 18:35:05 +01:00
|
|
|
connect_to_web map, ':web/files/pngs/:id', :controller => 'file', :action => 'blahtex_png', :requirements => {:id => /[-._\w]+/}, :id => nil
|
2007-03-11 05:31:24 +01:00
|
|
|
connect_to_web map, ':web/files/:id', :controller => 'file', :action => 'file', :requirements => {:id => /[-._\w]+/}, :id => nil
|
2009-01-11 05:33:30 +01:00
|
|
|
connect_to_web map, ':web/file_list/:sort_order', :controller => 'wiki', :action => 'file_list', :sort_order => nil
|
2007-01-22 14:43:50 +01:00
|
|
|
connect_to_web map, ':web/import/:id', :controller => 'file', :action => 'import'
|
|
|
|
connect_to_web map, ':web/login', :controller => 'wiki', :action => 'login'
|
|
|
|
connect_to_web map, ':web/web_list', :controller => 'wiki', :action => 'web_list'
|
2010-01-27 04:53:37 +01:00
|
|
|
connect_to_web map, ':web/show/diff/:id', :controller => 'wiki', :action => 'show', :mode => 'diff', :requirements => {:id => id_regexp}
|
2010-01-26 07:48:16 +01:00
|
|
|
connect_to_web map, ':web/revision/diff/:id/:rev', :controller => 'wiki', :action => 'revision', :mode => 'diff',
|
2010-01-27 04:53:37 +01:00
|
|
|
:requirements => { :rev => /\d+/, :id => id_regexp}
|
|
|
|
connect_to_web map, ':web/revision/:id/:rev', :controller => 'wiki', :action => 'revision', :requirements => { :rev => /\d+/, :id => id_regexp}
|
2011-08-28 04:58:14 +02:00
|
|
|
connect_to_web map, ':web/source/:id/:rev', :controller => 'wiki', :action => 'source', :requirements => { :rev => /\d+/, :id => id_regexp}
|
2007-03-10 07:18:18 +01:00
|
|
|
connect_to_web map, ':web/list/:category', :controller => 'wiki', :action => 'list', :requirements => { :category => /.*/}, :category => nil
|
|
|
|
connect_to_web map, ':web/recently_revised/:category', :controller => 'wiki', :action => 'recently_revised', :requirements => { :category => /.*/}, :category => nil
|
2010-01-27 04:53:37 +01:00
|
|
|
connect_to_web map, ':web/:action/:id', :controller => 'wiki', :requirements => {:id => id_regexp}
|
2007-01-22 14:43:50 +01:00
|
|
|
connect_to_web map, ':web/:action', :controller => 'wiki'
|
|
|
|
connect_to_web map, ':web', :controller => 'wiki', :action => 'index'
|
|
|
|
|
|
|
|
if defined? DEFAULT_WEB
|
|
|
|
map.connect '', :controller => 'wiki', :web => DEFAULT_WEB, :action => 'index'
|
|
|
|
else
|
|
|
|
map.connect '', :controller => 'wiki', :action => 'index'
|
|
|
|
end
|
|
|
|
end
|