forked from smudge/shifts
/
routes.rb
executable file
·141 lines (106 loc) · 6.26 KB
/
routes.rb
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
ActionController::Routing::Routes.draw do |map|
map.with_options :controller => 'first_run' do |f|
f.first_app_config 'firstrun/first_app_config', :action => 'new_app_config', :method => 'get'
f.first_department 'firstrun/first_department', :action => 'new_department', :method => 'get'
f.first_user 'firstrun/first_user', :action => 'new_user', :method => 'get'
f.create_first_app_config 'firstrun/create_first_app_config', :action => 'create_app_config', :method => 'post'
f.create_first_department 'firstrun/create_first_department', :action => 'create_department', :method => 'post'
f.create_first_user 'firstrun/create_first_user', :action => 'create_user', :method => 'post'
end
map.resources :app_configs, :only => [:edit, :update]
map.edit_app_config "/app_config", :controller => 'app_configs', :action => 'edit', :method => 'get'
map.resources :punch_clocks
map.resources :restrictions
map.email_reminders "/email_reminders", :controller => 'payforms', :action => 'email_reminders'
map.reminders_advanced_options "/reminders_advanced_options", :controller => 'payforms', :action => 'reminders_advanced_options'
map.warnings_advanced_options "/warnings_advanced_options", :controller => 'payforms', :action => 'warnings_advanced_options'
map.login "/login", :controller => 'user_sessions', :action => 'new'
map.logout "/logout", :controller => 'user_sessions', :action => 'destroy'
#TODO: get rid of sessions controller and move logout action to user_session controller and name it cas_logout
map.cas_logout "/cas_logout", :controller => 'sessions', :action => 'logout'
# routes for managing superusers
map.superusers "/superusers", :controller => 'superusers'
map.add_superusers "/superusers/add", :controller => 'superusers', :action => 'add'
map.remove_superusers "/superusers/remove", :controller => 'superusers', :action => 'remove'
map.resources :user_sessions
map.resources :password_resets
map.resources :user_configs, :only => [:edit, :update]
map.resources :sub_requests
map.resources :notices, :collection => {:archive => :get}
map.resources :payform_item_sets
map.resources :payform_sets
map.resources :department_configs, :only => [:edit, :update]
map.resources :payforms,
:collection => { :prune => :delete, :go => :get, :search => :post},
:member => {:submit => :put, :approve => :put, :print => :put},
:shallow => true do |payform|
payform.resources :payform_items, :member => {:delete => :get}
end
map.resources :payform_items
map.resources :time_slots #TODO: What should this be nested under, if anything?
map.resources :shifts, :new => {:unscheduled => :get, :power_sign_up => :get, :ajax_create => :post}, :collection => {:show_active => :get, :show_unscheduled => :get}, :shallow => true do |shifts|
shifts.resource :report do |report|
report.resources :report_items
end
#NOTE: "sub_requests" is a clearer model name, we use subs for routing
shifts.resources :sub_requests, :member => {:take => :post, :get_take_info => :get},
:as => "subs"
end
map.resources :users, :collection => {:update_superusers => :post} do |user|
user.resources :punch_clocks
end
map.resources :reports, :member => {:popup => :get} do |report|
report.resources :report_items
end
map.view_all_data_objects "data_objects/view_all_data_objects", :controller => "data_objects", :action => "view_all"
map.resources :data_types do |data_type|
data_type.resources :data_fields
data_type.resources :data_objects, :only => [:new, :create]
end
map.resources :data_objects do |data_object|
data_object.resources :data_entries
end
map.resources :departments, :shallow => true do |departments|
departments.resources :users, :collection => {:mass_add => :get, :mass_create => :post, :restore => :post, :autocomplete => :get, :search => :post, :import => :get, :save_import => :post}
departments.resources :loc_groups
departments.resources :locations
departments.resources :roles
departments.resources :categories
end
# permission is always created indirectly so there is only index method that lists them
map.resources :permissions, :only => :index
map.dashboard '/dashboard', :controller => 'dashboard', :action => 'index'
map.access_denied '/access_denied', :controller => 'application', :action => 'access_denied'
# 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
# Sample of named route:
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# map.resources :products
# Sample resource route with options:
# map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
# Sample resource route with sub-resources:
# map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
# Sample resource route with more complex sub-resources
# map.resources :products do |products|
# products.resources :comments
# products.resources :sales, :collection => { :recent => :get }
# end
# Sample resource route within a namespace:
# map.namespace :admin do |admin|
# # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
# admin.resources :products
# end
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
# map.root :controller => "welcome"
map.root :controller => "dashboard"
# See how all your routes lay out with "rake routes"
# Install the default routes as the lowest priority.
# Note: These default routes make all actions in every controller accessible via GET requests. You should
# consider removing the them or commenting them out if you're using named routes and resources.
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end