Added module layer to use separate files for routes.
This commit is contained in:
parent
3c38b2fd7c
commit
11402f874d
6 changed files with 96 additions and 51 deletions
|
@ -8,57 +8,6 @@ Zammad::Application.routes.draw do
|
|||
# just remember to delete public/index.html.
|
||||
root :to => 'init#index'
|
||||
|
||||
# omniauth
|
||||
match '/auth/:provider/callback', :to => 'sessions#create_omniauth'
|
||||
|
||||
# base objects
|
||||
resources :settings, :only => [:create, :show, :index, :update]
|
||||
resources :users, :only => [:create, :show, :index, :update]
|
||||
match '/users/password_reset', :to => 'users#password_reset_send'
|
||||
match '/users/password_reset_verify', :to => 'users#password_reset_verify'
|
||||
resources :groups, :only => [:create, :show, :index, :update]
|
||||
resources :roles, :only => [:create, :show, :index, :update]
|
||||
resources :organizations, :only => [:create, :show, :index, :update]
|
||||
resources :templates
|
||||
|
||||
# overviews
|
||||
resources :overviews
|
||||
|
||||
# notes
|
||||
resources :notes
|
||||
|
||||
# tickets
|
||||
resources :channels, :only => [:create, :show, :index, :update, :destroy]
|
||||
resources :ticket_articles, :only => [:create, :show, :index, :update]
|
||||
resources :ticket_priorities, :only => [:create, :show, :index, :update]
|
||||
resources :ticket_states, :only => [:create, :show, :index, :update]
|
||||
resources :tickets, :only => [:create, :show, :index, :update]
|
||||
match '/ticket_full/:id', :to => 'ticket_overviews#ticket_full'
|
||||
match '/ticket_attachment/:id', :to => 'ticket_overviews#ticket_attachment'
|
||||
match '/ticket_attachment_new', :to => 'ticket_overviews#ticket_attachment_new'
|
||||
match '/ticket_history/:id', :to => 'ticket_overviews#ticket_history'
|
||||
match '/ticket_customer', :to => 'ticket_overviews#ticket_customer'
|
||||
match '/ticket_overviews', :to => 'ticket_overviews#show'
|
||||
match '/activity_stream', :to => 'ticket_overviews#activity_stream'
|
||||
match '/recent_viewed', :to => 'ticket_overviews#recent_viewed'
|
||||
match '/ticket_create', :to => 'ticket_overviews#ticket_create'
|
||||
match '/user_search', :to => 'ticket_overviews#user_search'
|
||||
|
||||
# networks
|
||||
resources :networks, :only => [:create, :show, :index, :update, :destroy]
|
||||
|
||||
# getting_started
|
||||
match '/getting_started', :to => 'getting_started#index'
|
||||
|
||||
# getting_started
|
||||
match '/rss_fetch', :to => 'rss#fetch'
|
||||
|
||||
# sessions
|
||||
resources :sessions, :only => [:create, :destroy, :show]
|
||||
match '/signin', :to => 'sessions#create'
|
||||
match '/signshow', :to => 'sessions#show'
|
||||
match '/signout', :to => 'sessions#destroy'
|
||||
|
||||
# The priority is based upon order of creation:
|
||||
# first created -> highest priority.
|
||||
|
||||
|
@ -115,4 +64,12 @@ Zammad::Application.routes.draw do
|
|||
# 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)'
|
||||
|
||||
# load routes from external files
|
||||
dir = File.expand_path('../', __FILE__)
|
||||
files = Dir.glob( "#{dir}/routes/*.rb" )
|
||||
for file in files
|
||||
require file
|
||||
ExtraRoutes.add(self)
|
||||
end
|
||||
end
|
||||
|
|
15
config/routes/auth.rb
Normal file
15
config/routes/auth.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
# omniauth
|
||||
map.match '/auth/:provider/callback', :to => 'sessions#create_omniauth'
|
||||
|
||||
# sessions
|
||||
map.resources :sessions, :only => [:create, :destroy, :show]
|
||||
map.match '/signin', :to => 'sessions#create'
|
||||
map.match '/signshow', :to => 'sessions#show'
|
||||
map.match '/signout', :to => 'sessions#destroy'
|
||||
|
||||
end
|
||||
module_function :add
|
||||
end
|
34
config/routes/base.rb
Normal file
34
config/routes/base.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
# base objects
|
||||
map.resources :settings, :only => [:create, :show, :index, :update]
|
||||
|
||||
# users
|
||||
map.resources :users, :only => [:create, :show, :index, :update]
|
||||
map.match '/users/password_reset', :to => 'users#password_reset_send'
|
||||
map.match '/users/password_reset_verify', :to => 'users#password_reset_verify'
|
||||
|
||||
# groups
|
||||
map.resources :groups, :only => [:create, :show, :index, :update]
|
||||
|
||||
# roles
|
||||
map.resources :roles, :only => [:create, :show, :index, :update]
|
||||
|
||||
# organizations
|
||||
map.resources :organizations, :only => [:create, :show, :index, :update]
|
||||
|
||||
# templates
|
||||
map.resources :templates
|
||||
|
||||
# overviews
|
||||
map.resources :overviews
|
||||
|
||||
# getting_started
|
||||
map.match '/getting_started', :to => 'getting_started#index'
|
||||
|
||||
# rss
|
||||
map.match '/rss_fetch', :to => 'rss#fetch'
|
||||
end
|
||||
module_function :add
|
||||
end
|
9
config/routes/network.rb
Normal file
9
config/routes/network.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
# networks
|
||||
map.resources :networks, :only => [:create, :show, :index, :update, :destroy]
|
||||
|
||||
end
|
||||
module_function :add
|
||||
end
|
23
config/routes/ticket.rb
Normal file
23
config/routes/ticket.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
|
||||
# tickets
|
||||
map.resources :channels, :only => [:create, :show, :index, :update, :destroy]
|
||||
map.resources :ticket_articles, :only => [:create, :show, :index, :update]
|
||||
map.resources :ticket_priorities, :only => [:create, :show, :index, :update]
|
||||
map.resources :ticket_states, :only => [:create, :show, :index, :update]
|
||||
map.resources :tickets, :only => [:create, :show, :index, :update]
|
||||
map.match '/ticket_full/:id', :to => 'ticket_overviews#ticket_full'
|
||||
map.match '/ticket_attachment/:id', :to => 'ticket_overviews#ticket_attachment'
|
||||
map.match '/ticket_attachment_new', :to => 'ticket_overviews#ticket_attachment_new'
|
||||
map.match '/ticket_history/:id', :to => 'ticket_overviews#ticket_history'
|
||||
map.match '/ticket_customer', :to => 'ticket_overviews#ticket_customer'
|
||||
map.match '/ticket_overviews', :to => 'ticket_overviews#show'
|
||||
map.match '/activity_stream', :to => 'ticket_overviews#activity_stream'
|
||||
map.match '/recent_viewed', :to => 'ticket_overviews#recent_viewed'
|
||||
map.match '/ticket_create', :to => 'ticket_overviews#ticket_create'
|
||||
map.match '/user_search', :to => 'ticket_overviews#user_search'
|
||||
|
||||
end
|
||||
module_function :add
|
||||
end
|
7
config/routes/translation.rb
Normal file
7
config/routes/translation.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
module ExtraRoutes
|
||||
def add(map)
|
||||
map.resources :translations
|
||||
map.match '/translations/lang/:locale', :to => 'translations#load'
|
||||
end
|
||||
module_function :add
|
||||
end
|
Loading…
Reference in a new issue