diff --git a/config/routes.rb b/config/routes.rb index 577f11006..69fbbf1ed 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/config/routes/auth.rb b/config/routes/auth.rb new file mode 100644 index 000000000..58c9162d1 --- /dev/null +++ b/config/routes/auth.rb @@ -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 \ No newline at end of file diff --git a/config/routes/base.rb b/config/routes/base.rb new file mode 100644 index 000000000..5ed18d907 --- /dev/null +++ b/config/routes/base.rb @@ -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 \ No newline at end of file diff --git a/config/routes/network.rb b/config/routes/network.rb new file mode 100644 index 000000000..0b38d33c0 --- /dev/null +++ b/config/routes/network.rb @@ -0,0 +1,9 @@ +module ExtraRoutes + def add(map) + + # networks + map.resources :networks, :only => [:create, :show, :index, :update, :destroy] + + end + module_function :add +end \ No newline at end of file diff --git a/config/routes/ticket.rb b/config/routes/ticket.rb new file mode 100644 index 000000000..e54cc15df --- /dev/null +++ b/config/routes/ticket.rb @@ -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 \ No newline at end of file diff --git a/config/routes/translation.rb b/config/routes/translation.rb new file mode 100644 index 000000000..2e6d23562 --- /dev/null +++ b/config/routes/translation.rb @@ -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 \ No newline at end of file