2009-01-06 11:49:19 +01:00
|
|
|
ActionController::Routing::Routes.draw do |map|
|
2010-03-20 02:26:30 +01:00
|
|
|
|
2010-03-20 13:45:58 +01:00
|
|
|
# Use routing filter to select foodcoop config and datbase
|
2010-03-20 02:26:30 +01:00
|
|
|
map.filter 'foodcoop', :file => File.join(RAILS_ROOT, "lib", "foodcoop_filter")
|
2009-02-12 18:32:20 +01:00
|
|
|
|
2010-03-20 13:45:58 +01:00
|
|
|
# Root path
|
|
|
|
map.root :controller => 'home', :action => 'index'
|
|
|
|
|
|
|
|
# User specific
|
2010-03-20 14:49:46 +01:00
|
|
|
map.login "/login", :controller => 'login', :action => 'login'
|
2009-02-12 21:38:41 +01:00
|
|
|
map.logout '/logout', :controller => 'login', :action => 'logout'
|
2009-01-15 12:14:01 +01:00
|
|
|
map.my_profile '/home/profile', :controller => 'home', :action => 'profile'
|
2009-02-06 21:18:20 +01:00
|
|
|
map.my_ordergroup '/home/ordergroup', :controller => 'home', :action => 'ordergroup'
|
2009-01-06 15:45:19 +01:00
|
|
|
|
2010-03-20 13:45:58 +01:00
|
|
|
# Wiki
|
|
|
|
map.resources :pages, :collection => { :all => :get }, :member => {:version => :get, :revert => :get}
|
|
|
|
map.wiki_page "/wiki/:permalink", :controller => 'pages', :action => 'show', :permalink => /[^\s]+/
|
|
|
|
map.wiki "/wiki", :controller => 'pages', :action => 'show', :permalink => 'Home'
|
|
|
|
|
|
|
|
# Orders, ordering
|
2009-01-29 01:57:51 +01:00
|
|
|
map.resources :orders, :member => { :finish => :post, :add_comment => :post }
|
2010-03-20 13:45:58 +01:00
|
|
|
map.with_options :controller => "ordering" do |ordering|
|
|
|
|
ordering.ordering "/ordering", :action => "index"
|
|
|
|
ordering.my_orders "/ordering/myOrders", :action => "myOrders"
|
|
|
|
end
|
2009-01-29 01:57:51 +01:00
|
|
|
|
2009-01-15 18:26:37 +01:00
|
|
|
|
2010-03-20 13:45:58 +01:00
|
|
|
# Foodcoop orga
|
2009-08-02 19:41:09 +02:00
|
|
|
map.resources :invites, :only => [:new, :create]
|
2010-03-20 13:45:58 +01:00
|
|
|
map.resources :tasks,
|
|
|
|
:collection => {:user => :get}
|
|
|
|
map.resources :messages, :only => [:index, :show, :new, :create],
|
|
|
|
:member => { :reply => :get, :user => :get, :group => :get }
|
2009-08-02 18:12:13 +02:00
|
|
|
map.namespace :foodcoop do |foodcoop|
|
2009-10-17 11:53:17 +02:00
|
|
|
foodcoop.root :controller => "users", :action => "index"
|
2009-08-02 19:01:45 +02:00
|
|
|
foodcoop.resources :users, :only => [:index]
|
2009-08-02 18:12:13 +02:00
|
|
|
foodcoop.resources :ordergroups, :only => [:index]
|
2009-08-02 18:42:52 +02:00
|
|
|
foodcoop.resources :workgroups, :only => [:index, :edit, :update],
|
|
|
|
:member => {:memberships => :get}
|
2009-08-02 18:12:13 +02:00
|
|
|
end
|
|
|
|
|
2010-03-20 13:45:58 +01:00
|
|
|
# Article management
|
2009-08-02 19:01:45 +02:00
|
|
|
map.resources :stock_takings,
|
|
|
|
:collection => {:fill_new_stock_article_form => :get, :add_stock_article => :post}
|
|
|
|
map.resources :stock_articles,
|
|
|
|
:controller => 'stockit', :as => 'stockit',
|
|
|
|
:collection => {:auto_complete_for_article_name => :get, :fill_new_stock_article_form => :get}
|
2010-03-20 13:45:58 +01:00
|
|
|
|
2009-02-12 18:32:20 +01:00
|
|
|
map.resources :suppliers,
|
|
|
|
:collection => { :shared_suppliers => :get } do |suppliers|
|
|
|
|
suppliers.resources :deliveries,
|
|
|
|
:member => { :drop_stock_change => :post },
|
2009-02-06 16:26:35 +01:00
|
|
|
:collection => {:add_stock_article => :post}
|
2009-01-16 16:19:26 +01:00
|
|
|
suppliers.resources :articles,
|
|
|
|
:collection => { :update_selected => :post, :edit_all => :get, :update_all => :post,
|
|
|
|
:upload => :get, :parse_upload => :post, :create_from_upload => :post,
|
|
|
|
:shared => :get, :import => :get, :sync => :post }
|
2009-01-16 02:17:49 +01:00
|
|
|
end
|
2009-01-16 16:19:26 +01:00
|
|
|
map.resources :article_categories
|
2009-01-08 16:33:27 +01:00
|
|
|
|
2010-03-20 13:45:58 +01:00
|
|
|
# Finance
|
|
|
|
map.namespace :finance do |finance|
|
|
|
|
finance.root :controller => 'balancing'
|
|
|
|
finance.balancing "balancing/list", :controller => 'balancing', :action => 'list'
|
|
|
|
finance.resources :invoices
|
|
|
|
finance.resources :transactions
|
|
|
|
end
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2010-03-20 13:45:58 +01:00
|
|
|
# Administration
|
|
|
|
map.namespace :admin do |admin|
|
|
|
|
admin.root :controller => "admin", :action => "index"
|
|
|
|
admin.resources :users
|
|
|
|
admin.resources :workgroups, :member => { :memberships => :get }
|
|
|
|
admin.resources :ordergroups, :member => { :memberships => :get }
|
|
|
|
end
|
2009-01-06 11:49:19 +01:00
|
|
|
|
|
|
|
# Install the default route as the lowest priority.
|
2009-01-07 15:29:23 +01:00
|
|
|
map.connect ':controller/:action/:id'
|
|
|
|
map.connect ':controller/:action/:id.:format'
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|