Skip to content

Instantly share code, notes, and snippets.

@Matheus-de-Souza
Created July 27, 2011 13:52
Show Gist options
  • Save Matheus-de-Souza/1109399 to your computer and use it in GitHub Desktop.
Save Matheus-de-Souza/1109399 to your computer and use it in GitHub Desktop.
Store::Application.routes.draw do
match 'select_url' => 'others/products#select_url'
wiki_root 'ecommerce/wiki'
wiki_root 'publisher/wiki'
wiki_root 'saas/wiki'
def ecommerces
resources :ecommerces, :module => :ecommerce, :except => [:show, :destroy, :edit, :update, :create, :new, :index] do
put 'update'
get 'edit'
match '/' => 'dashboard#index', :as => 'root'
match 'tracking_code_update'
match 'add_credit'
match 'boleto'
resources :products, :only => :index do
collection do
get 'import'
get 'import_history'
post 'create_products_import'
end
end
resources :dashboard, :only => :index do
get 'graph_code', :on => :collection
end
resource :reports, :except => [:show, :destroy, :edit, :update, :create, :new, :index] do
match '/' => 'reports#index'
match 'load_campaigns', :on => :collection
end
resources :campaigns, :except => [:show, :destroy] do
member do
get 'activate'
get 'deactivate'
get 'add_or_delete_products'
match 'select_locations'
match 'products'
match 'added_products'
match 'change_cost'
end
end
end
resources :ecommerces, :except => [:show, :destroy, :edit, :update, :create, :new, :index] do
resources :users, :except => :show do
match 'reinvite'
get 'my_account', :on => :member
collection do
get 'check_user'
get 'valid_user'
post 'invite'
end
end
end
end
def publishers
resources :publishers, :module => :publisher, :except => [:show, :destroy, :edit, :update, :create, :new, :index] do
match 'publisher' => 'dashboard#index', :as => 'root'
match '/' => 'dashboard#index'
match 'general'
match 'terms'
match 'cpc_values'
resources :affiliate_programs
resources :widget_formats, :except => :show
resources :incomes, :only => :index
resource :dashboard, :only => :index, :controller => :dashboard do
match 'index'
match 'graph_code'
end
resources :widgets, :except => [:show] do
match 'reports' => 'reports#index', :as => 'reports'
end
resources :sites, :except => [:show] do
match 'delete_area/:area_id' => 'sites#delete_area', :as => 'delete_area'
match 'reports' => 'reports#index', :as => 'reports'
get 'update_area'
get 'add_area'
end
resource :reports, :except => [:show, :destroy, :edit, :update, :create, :new, :index] do
match '/' => 'reports#index'
get '/:format' => 'reports#index', :as => 'reports_format'
get 'load_widgets/:format_id/:site_id' => 'reports#load_widgets', :as => 'load_widgets'
end
end
resources :publishers, :except => [:show, :destroy, :edit, :update, :create, :new, :index] do
resources :users, :except => :show do
match 'reinvite'
get 'my_account', :on => :member
collection do
get 'check_user'
get 'valid_user'
post 'invite'
end
end
end
end
def saas
resources :saas, :except => [:show, :destroy, :edit, :update, :create, :new, :index] do
ecommerces
publishers
resources :users, :except => :show do
match 'reinvite'
get 'my_account', :on => :member
collection do
get 'check_user'
get 'valid_user'
post 'invite'
end
end
end
end
#admin
match '/' => 'admin/saas/admin_saas#index', :constraints => { :subdomain => 'admin' }
match 'admin' => 'admin/saas/admin_saas#index', :constraits => { :subdomain => 'admin' }
resource :admin, :module => 'admin', :except => [:show, :destroy, :edit, :update, :create, :new, :index] do
resources :saas, :module => 'saas', :controller => 'admin_saas', :except => [:show] do
get 'edit'
get 'show' => 'admin_saas_publishers#index'
resources :publishers, :controller => 'admin_saas_publishers', :except => [:show] do
get 'edit'
get 'show'
match 'select_publisher', :on => :collection
match 'check_user_email', :on => :collection
end
end
resources :saas_ecommerces, :controller => 'admin_saas_ecommerces', :except => [:show] do
get 'edit'
get 'show'
end
resources :ecommerces, :module => 'ecommerce', :controller => 'saas_ecommerces', :except => :show do
match 'select_ecommerce', :on => :collection
get 'show'
end
resources :publishers, :module => 'publisher', :controller => 'saas_publishers', :except => :show do
match 'select_publisher', :on => :collection
match 'check_user_email', :on => :collection
get 'show'
end
end
resource :admin, :except => [:show, :destroy, :edit, :update, :create, :new, :index] do
saas
resources :users, :except => :show do
match 'reinvite'
get 'my_account', :on => :member
collection do
get 'check_user'
get 'valid_user'
post 'invite'
end
end
end
# general
match '/' => 'ecommerce/dashboard#index', :constraints => { :subdomain => 'loja' }
match '/' => 'publisher/dashboard#index', :constraints => { :subdomain => 'publisher' }
match '/' => 'saas/publisher/saas_publishers#index', :constraints => { :subdomain => 'saas' }
match '/' => 'saas/dashboard#publisher_dashboard', :constraints => { :subdomain => 'dashboard' }, :as => 'saas_dashboard_root'
match 'dashboard/publisher' => 'saas/dashboard#publisher_dashboard', :constraints => { :subdomain => 'dashboard' }, :as => 'saas_dashboard_publisher'
match 'dashboard/ecommerce' => 'saas/dashboard#ecommerce_dashboard', :constraints => { :subdomain => 'dashboard' }, :as => 'saas_dashboard_ecommerce'
match 'dashboard' => 'saas/dashboard#publisher_dashboard'
match 'dashboard/publisher' => 'saas/dashboard#publisher_dashboard'
match 'dashboard/ecommerce' => 'saas/dashboard#ecommerce_dashboard'
match 'ecommerce' => 'ecommerce/dashboard#index'
match 'publisher' => 'publisher/dashboard#index'
match 'saas' => 'saas/publisher/saas_publishers#index'
match 'errors/render_404' => 'errors#render_404', :as => 'render_404'
resources :saas, :module => 'saas', :except => [:show, :destroy, :edit, :update, :create, :new, :index] do
match '/' => 'publisher/saas_publishers#index', :as => 'root'
match 'ecommerce_graph_code' => 'dashboard#ecommerce_graph_code'
match 'publisher_graph_code' => 'dashboard#publisher_graph_code'
resources :ecommerces, :module => 'ecommerce', :controller => 'saas_ecommerces', :except => :show do
match 'select_ecommerce', :on => :collection
get 'show'
end
resources :publishers, :module => 'publisher', :controller => 'saas_publishers', :except => :show do
match 'select_publisher', :on => :collection
match 'check_user_email', :on => :collection
get 'show'
end
end
saas
# user routes
devise_for :users, :controllers => { :sessions => 'sessions', :invitations => 'invitations' }, :skip => [:sessions] do
get 'sign_in' => 'sessions#new', :as => :new_user_session
post 'sign_in' => 'sessions#create', :as => :user_session
get 'sign_out' => 'sessions#destroy', :as => :destroy_user_session
get 'sign_out_and_redirect' => 'sessions#sign_out_and_redirect', :as => :sign_out_and_redirect
end
devise_scope :user do
get '/saas/user/edit' => 'devise/registrations#edit', :as => 'saas_user_edit'
end
root :to => 'ecommerce/dashboard#index'
# http://techoctave.com/c7/posts/36-rails-3-0-rescue-from-routing-error-solution
# match '*a', :to => 'errors#render_404'
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => "welcome#index"
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment