aboutsummaryrefslogtreecommitdiffstats
path: root/config/routes.rb
blob: 5c5cc905bc0d6c3de0bb965e9581b4702da78208 (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# config/routes.rb:
# Mapping URLs to controllers for FOIFA.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
# $Id: routes.rb,v 1.16 2007-10-30 14:49:08 francis Exp $

ActionController::Routing::Routes.draw do |map|
    # The priority is based upon order of creation: first created -> highest priority.

    # Sample of regular route:
    # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
    # Keep in mind you can assign values other than :controller and :action
    
    map.with_options :controller => 'request' do |request|
      request.home           '/',            :action => 'frontpage'
      request.request_list   '/list',        :action => 'list'
      request.new_request    '/new',         :action => 'new'
      request.create_request '/create',      :action => 'create' 
      request.request        '/request/:id', :action => 'show'   
    end

    map.with_options :controller => 'user' do |user|
      user.signin '/signin',        :action => 'signin'
      user.signup '/signup',        :action => 'signup'
      user.signout '/signout',      :action => 'signout'
      user.show_user "/user/:name", :action => 'show'
    end

    map.public_body "/body/:short_name", :controller => 'body', :action => 'show'

    map.connect '/admin/:action', :controller => 'admin', :action => 'index'
    map.connect '/admin/body/:action/:id', :controller => 'admin_public_body'

    # Sample of named route:
    # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
    # This route can be invoked with purchase_url(:id => product.id)

    # You can have the root of your site routed by hooking up '' 
    # -- just remember to delete public/index.html.
    # map.connect '', :controller => "welcome"

    # Allow downloading Web Service WSDL as a file with an extension
    # instead of a file named 'wsdl'
    map.connect ':controller/service.wsdl', :action => 'wsdl'

    # Install the default route as the lowest priority.
    # FAI: Turned off for now, as to be honest I don't trust it from a security point of view.
    # Somebody is bound to leave a method public in a controller that shouldn't be.
    #map.connect ':controller/:action/:id.:format'
    #map.connect ':controller/:action/:id'
    # map.connect '/:controller/:action'
end