From 04854f8b075fd117a1f9cbf3f9849eff493f856e Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 21 Aug 2013 21:16:42 +0200 Subject: [PATCH] Moved to new router style. --- config/application.rb | 3 ++ config/routes.rb | 9 +--- config/routes/activity_stream.rb | 10 ++--- config/routes/auth.rb | 29 ++++++------ config/routes/channel.rb | 18 ++++---- config/routes/email_address.rb | 16 +++---- config/routes/getting_started.rb | 12 +++-- config/routes/group.rb | 16 +++---- config/routes/link.rb | 16 +++---- config/routes/message.rb | 14 +++--- config/routes/network.rb | 18 ++++---- config/routes/organization.rb | 18 ++++---- config/routes/overview.rb | 18 ++++---- config/routes/package.rb | 14 +++--- config/routes/postmaster_filter.rb | 18 ++++---- config/routes/recent_viewed.rb | 11 ++--- config/routes/role.rb | 16 +++---- config/routes/rss.rb | 12 +++-- config/routes/search.rb | 10 ++--- config/routes/setting.rb | 18 ++++---- config/routes/signature.rb | 18 ++++---- config/routes/sla.rb | 18 ++++---- config/routes/tag.rb | 16 +++---- config/routes/taskbar.rb | 20 ++++----- config/routes/template.rb | 18 ++++---- config/routes/test.rb | 13 +++--- config/routes/text_module.rb | 18 ++++---- config/routes/ticket.rb | 72 +++++++++++++++--------------- config/routes/translation.rb | 21 +++++---- config/routes/user.rb | 28 ++++++------ 30 files changed, 240 insertions(+), 298 deletions(-) diff --git a/config/application.rb b/config/application.rb index 4620f22aa..660fa2180 100644 --- a/config/application.rb +++ b/config/application.rb @@ -82,5 +82,8 @@ module Zammad # Enable threaded mode config.threadsafe! + # catch all router files + config.paths['config/routes'] += Dir[Rails.root.join("config/routes/*.rb")] + end end diff --git a/config/routes.rb b/config/routes.rb index ba2c772e9..ecf3f32e4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,11 +8,4 @@ Zammad::Application.routes.draw do # just remember to delete public/index.html. root :to => 'init#index', :via => :get - # load routes from external files - dir = File.expand_path('../', __FILE__) - files = Dir.glob( "#{dir}/routes/*.rb" ) - for file in files - load file - ExtraRoutes.add(self, Rails.configuration.api_path) - end -end +end \ No newline at end of file diff --git a/config/routes/activity_stream.rb b/config/routes/activity_stream.rb index fc2471628..d43837358 100644 --- a/config/routes/activity_stream.rb +++ b/config/routes/activity_stream.rb @@ -1,8 +1,6 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - map.match api_path + '/activity_stream', :to => 'activity#activity_stream', :via => :get + match api_path + '/activity_stream', :to => 'activity#activity_stream', :via => :get - end - module_function :add -end +end \ No newline at end of file diff --git a/config/routes/auth.rb b/config/routes/auth.rb index 5cd782898..e8098fbb3 100644 --- a/config/routes/auth.rb +++ b/config/routes/auth.rb @@ -1,19 +1,18 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # omniauth - map.match '/auth/:provider/callback', :to => 'sessions#create_omniauth',:via => [:post, :get, :puts, :delete] + # omniauth + match '/auth/:provider/callback', :to => 'sessions#create_omniauth',:via => [:post, :get, :puts, :delete] - # sso - map.match '/auth/sso', :to => 'sessions#create_sso', :via => [:post, :get] + # sso + match '/auth/sso', :to => 'sessions#create_sso', :via => [:post, :get] - # sessions - map.match api_path + '/signin', :to => 'sessions#create', :via => :post - map.match api_path + '/signshow', :to => 'sessions#show', :via => :get - map.match api_path + '/signout', :to => 'sessions#destroy', :via => [:get, :delete] + # sessions + match api_path + '/signin', :to => 'sessions#create', :via => :post + match api_path + '/signshow', :to => 'sessions#show', :via => :get + match api_path + '/signout', :to => 'sessions#destroy', :via => [:get, :delete] - map.match api_path + '/sessions', :to => 'sessions#list', :via => :get - map.match api_path + '/sessions/:id', :to => 'sessions#delete', :via => :delete - end - module_function :add -end + match api_path + '/sessions', :to => 'sessions#list', :via => :get + match api_path + '/sessions/:id', :to => 'sessions#delete', :via => :delete + +end \ No newline at end of file diff --git a/config/routes/channel.rb b/config/routes/channel.rb index be37a5949..2939a3773 100644 --- a/config/routes/channel.rb +++ b/config/routes/channel.rb @@ -1,13 +1,11 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # channels - map.match api_path + '/channels', :to => 'channels#index', :via => :get - map.match api_path + '/channels/:id', :to => 'channels#show', :via => :get - map.match api_path + '/channels', :to => 'channels#create', :via => :post - map.match api_path + '/channels/:id', :to => 'channels#update', :via => :put - map.match api_path + '/channels/:id', :to => 'channels#destroy', :via => :delete + # channels + match api_path + '/channels', :to => 'channels#index', :via => :get + match api_path + '/channels/:id', :to => 'channels#show', :via => :get + match api_path + '/channels', :to => 'channels#create', :via => :post + match api_path + '/channels/:id', :to => 'channels#update', :via => :put + match api_path + '/channels/:id', :to => 'channels#destroy', :via => :delete - end - module_function :add end \ No newline at end of file diff --git a/config/routes/email_address.rb b/config/routes/email_address.rb index 6b61c6a20..986bb2f26 100644 --- a/config/routes/email_address.rb +++ b/config/routes/email_address.rb @@ -1,12 +1,10 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # groups - map.match api_path + '/email_addresses', :to => 'email_addresses#index', :via => :get - map.match api_path + '/email_addresses/:id', :to => 'email_addresses#show', :via => :get - map.match api_path + '/email_addresses', :to => 'email_addresses#create', :via => :post - map.match api_path + '/email_addresses/:id', :to => 'email_addresses#update', :via => :put + # groups + match api_path + '/email_addresses', :to => 'email_addresses#index', :via => :get + match api_path + '/email_addresses/:id', :to => 'email_addresses#show', :via => :get + match api_path + '/email_addresses', :to => 'email_addresses#create', :via => :post + match api_path + '/email_addresses/:id', :to => 'email_addresses#update', :via => :put - end - module_function :add end \ No newline at end of file diff --git a/config/routes/getting_started.rb b/config/routes/getting_started.rb index c6444a37e..398b61da7 100644 --- a/config/routes/getting_started.rb +++ b/config/routes/getting_started.rb @@ -1,9 +1,7 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # getting_started - map.match api_path + '/getting_started', :to => 'getting_started#index', :via => :get + # getting_started + match api_path + '/getting_started', :to => 'getting_started#index', :via => :get - end - module_function :add -end +end \ No newline at end of file diff --git a/config/routes/group.rb b/config/routes/group.rb index 0f5e50caa..1ae094968 100644 --- a/config/routes/group.rb +++ b/config/routes/group.rb @@ -1,12 +1,10 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # groups - map.match api_path + '/groups', :to => 'groups#index', :via => :get - map.match api_path + '/groups/:id', :to => 'groups#show', :via => :get - map.match api_path + '/groups', :to => 'groups#create', :via => :post - map.match api_path + '/groups/:id', :to => 'groups#update', :via => :put + # groups + match api_path + '/groups', :to => 'groups#index', :via => :get + match api_path + '/groups/:id', :to => 'groups#show', :via => :get + match api_path + '/groups', :to => 'groups#create', :via => :post + match api_path + '/groups/:id', :to => 'groups#update', :via => :put - end - module_function :add end \ No newline at end of file diff --git a/config/routes/link.rb b/config/routes/link.rb index 3a2c09526..4db9d8283 100644 --- a/config/routes/link.rb +++ b/config/routes/link.rb @@ -1,11 +1,9 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # links - map.match api_path + '/links', :to => 'links#index', :via => :get - map.match api_path + '/links/add', :to => 'links#add', :via => :get - map.match api_path + '/links/remove', :to => 'links#remove', :via => :get + # links + match api_path + '/links', :to => 'links#index', :via => :get + match api_path + '/links/add', :to => 'links#add', :via => :get + match api_path + '/links/remove', :to => 'links#remove', :via => :get - end - module_function :add -end +end \ No newline at end of file diff --git a/config/routes/message.rb b/config/routes/message.rb index 10acb3d3f..4071ff9eb 100644 --- a/config/routes/message.rb +++ b/config/routes/message.rb @@ -1,10 +1,8 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # messages - map.match api_path + '/message_send', :to => 'long_polling#message_send', :via => [ :get, :post ] - map.match api_path + '/message_receive', :to => 'long_polling#message_receive', :via => [ :get, :post ] + # messages + match api_path + '/message_send', :to => 'long_polling#message_send', :via => [ :get, :post ] + match api_path + '/message_receive', :to => 'long_polling#message_receive', :via => [ :get, :post ] - end - module_function :add -end +end \ No newline at end of file diff --git a/config/routes/network.rb b/config/routes/network.rb index b0e41d99e..a54cca873 100644 --- a/config/routes/network.rb +++ b/config/routes/network.rb @@ -1,13 +1,11 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # networkss - map.match api_path + '/networks', :to => 'networks#index', :via => :get - map.match api_path + '/networks/:id', :to => 'networks#show', :via => :get - map.match api_path + '/networks', :to => 'networks#create', :via => :post - map.match api_path + '/networks/:id', :to => 'networks#update', :via => :put - map.match api_path + '/networks/:id', :to => 'networks#destroy',:via => :delete + # networkss + match api_path + '/networks', :to => 'networks#index', :via => :get + match api_path + '/networks/:id', :to => 'networks#show', :via => :get + match api_path + '/networks', :to => 'networks#create', :via => :post + match api_path + '/networks/:id', :to => 'networks#update', :via => :put + match api_path + '/networks/:id', :to => 'networks#destroy',:via => :delete - end - module_function :add end \ No newline at end of file diff --git a/config/routes/organization.rb b/config/routes/organization.rb index de3471da9..444749c0a 100644 --- a/config/routes/organization.rb +++ b/config/routes/organization.rb @@ -1,12 +1,10 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # organizations - map.match api_path + '/organizations', :to => 'organizations#index', :via => :get - map.match api_path + '/organizations/:id', :to => 'organizations#show', :via => :get - map.match api_path + '/organizations', :to => 'organizations#create', :via => :post - map.match api_path + '/organizations/:id', :to => 'organizations#update', :via => :put + # organizations + match api_path + '/organizations', :to => 'organizations#index', :via => :get + match api_path + '/organizations/:id', :to => 'organizations#show', :via => :get + match api_path + '/organizations', :to => 'organizations#create', :via => :post + match api_path + '/organizations/:id', :to => 'organizations#update', :via => :put - end - module_function :add -end +end \ No newline at end of file diff --git a/config/routes/overview.rb b/config/routes/overview.rb index 0483f2ae7..819a806a8 100644 --- a/config/routes/overview.rb +++ b/config/routes/overview.rb @@ -1,13 +1,11 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # overviews - map.match api_path + '/overviews', :to => 'overviews#index', :via => :get - map.match api_path + '/overviews/:id', :to => 'overviews#show', :via => :get - map.match api_path + '/overviews', :to => 'overviews#create', :via => :post - map.match api_path + '/overviews/:id', :to => 'overviews#update', :via => :put - map.match api_path + '/overviews/:id', :to => 'overviews#destroy', :via => :delete + # overviews + match api_path + '/overviews', :to => 'overviews#index', :via => :get + match api_path + '/overviews/:id', :to => 'overviews#show', :via => :get + match api_path + '/overviews', :to => 'overviews#create', :via => :post + match api_path + '/overviews/:id', :to => 'overviews#update', :via => :put + match api_path + '/overviews/:id', :to => 'overviews#destroy', :via => :delete - end - module_function :add end \ No newline at end of file diff --git a/config/routes/package.rb b/config/routes/package.rb index 3bec7c136..6ea4ff9ab 100644 --- a/config/routes/package.rb +++ b/config/routes/package.rb @@ -1,11 +1,9 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # overviews - map.match api_path + '/packages', :to => 'packages#index', :via => :get - map.match api_path + '/packages', :to => 'packages#install', :via => :post - map.match api_path + '/packages', :to => 'packages#uninstall', :via => :delete + # overviews + match api_path + '/packages', :to => 'packages#index', :via => :get + match api_path + '/packages', :to => 'packages#install', :via => :post + match api_path + '/packages', :to => 'packages#uninstall', :via => :delete - end - module_function :add end \ No newline at end of file diff --git a/config/routes/postmaster_filter.rb b/config/routes/postmaster_filter.rb index 04251d14b..b8b9dd35f 100644 --- a/config/routes/postmaster_filter.rb +++ b/config/routes/postmaster_filter.rb @@ -1,13 +1,11 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # postmaster_filters - map.match api_path + '/postmaster_filters', :to => 'postmaster_filters#index', :via => :get - map.match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#show', :via => :get - map.match api_path + '/postmaster_filters', :to => 'postmaster_filters#create', :via => :post - map.match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#update', :via => :put - map.match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#destroy', :via => :delete + # postmaster_filters + match api_path + '/postmaster_filters', :to => 'postmaster_filters#index', :via => :get + match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#show', :via => :get + match api_path + '/postmaster_filters', :to => 'postmaster_filters#create', :via => :post + match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#update', :via => :put + match api_path + '/postmaster_filters/:id', :to => 'postmaster_filters#destroy', :via => :delete - end - module_function :add end \ No newline at end of file diff --git a/config/routes/recent_viewed.rb b/config/routes/recent_viewed.rb index cf1ef4c9b..ed388e9dd 100644 --- a/config/routes/recent_viewed.rb +++ b/config/routes/recent_viewed.rb @@ -1,8 +1,5 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - map.match api_path + '/recent_viewed', :to => 'recent_viewed#recent_viewed', :via => :get - - end - module_function :add -end + match api_path + '/recent_viewed', :to => 'recent_viewed#recent_viewed', :via => :get +end \ No newline at end of file diff --git a/config/routes/role.rb b/config/routes/role.rb index 621e02924..81c0596fc 100644 --- a/config/routes/role.rb +++ b/config/routes/role.rb @@ -1,12 +1,10 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # roles - map.match api_path + '/roles', :to => 'roles#index', :via => :get - map.match api_path + '/roles/:id', :to => 'roles#show', :via => :get - map.match api_path + '/roles', :to => 'roles#create', :via => :post - map.match api_path + '/roles/:id', :to => 'roles#update', :via => :put + # roles + match api_path + '/roles', :to => 'roles#index', :via => :get + match api_path + '/roles/:id', :to => 'roles#show', :via => :get + match api_path + '/roles', :to => 'roles#create', :via => :post + match api_path + '/roles/:id', :to => 'roles#update', :via => :put - end - module_function :add end \ No newline at end of file diff --git a/config/routes/rss.rb b/config/routes/rss.rb index ff31463c6..aff1aa2fd 100644 --- a/config/routes/rss.rb +++ b/config/routes/rss.rb @@ -1,9 +1,7 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # rss - map.match api_path + '/rss_fetch', :to => 'rss#fetch', :via => :get + # rss + match api_path + '/rss_fetch', :to => 'rss#fetch', :via => :get - end - module_function :add -end +end \ No newline at end of file diff --git a/config/routes/search.rb b/config/routes/search.rb index f28e8c963..ed877fd92 100644 --- a/config/routes/search.rb +++ b/config/routes/search.rb @@ -1,9 +1,7 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # search - map.match api_path + '/search', :to => 'search#search', :via => [:get, :post] + # search + match api_path + '/search', :to => 'search#search', :via => [:get, :post] - end - module_function :add end \ No newline at end of file diff --git a/config/routes/setting.rb b/config/routes/setting.rb index 0e9d7d5b8..ad739dc72 100644 --- a/config/routes/setting.rb +++ b/config/routes/setting.rb @@ -1,13 +1,11 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # base objects - map.match api_path + '/settings', :to => 'settings#index', :via => :get - map.match api_path + '/settings/:id', :to => 'settings#show', :via => :get - map.match api_path + '/settings', :to => 'settings#create', :via => :post - map.match api_path + '/settings/:id', :to => 'settings#update', :via => :put - map.match api_path + '/settings/:id', :to => 'settings#destroy', :via => :delete + # base objects + match api_path + '/settings', :to => 'settings#index', :via => :get + match api_path + '/settings/:id', :to => 'settings#show', :via => :get + match api_path + '/settings', :to => 'settings#create', :via => :post + match api_path + '/settings/:id', :to => 'settings#update', :via => :put + match api_path + '/settings/:id', :to => 'settings#destroy', :via => :delete - end - module_function :add end \ No newline at end of file diff --git a/config/routes/signature.rb b/config/routes/signature.rb index b4e21d2e7..a771634e3 100644 --- a/config/routes/signature.rb +++ b/config/routes/signature.rb @@ -1,13 +1,11 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # signatures - map.match api_path + '/signatures', :to => 'signatures#index', :via => :get - map.match api_path + '/signatures/:id', :to => 'signatures#show', :via => :get - map.match api_path + '/signatures', :to => 'signatures#create', :via => :post - map.match api_path + '/signatures/:id', :to => 'signatures#update', :via => :put - map.match api_path + '/signatures/:id', :to => 'signatures#destroy', :via => :delete + # signatures + match api_path + '/signatures', :to => 'signatures#index', :via => :get + match api_path + '/signatures/:id', :to => 'signatures#show', :via => :get + match api_path + '/signatures', :to => 'signatures#create', :via => :post + match api_path + '/signatures/:id', :to => 'signatures#update', :via => :put + match api_path + '/signatures/:id', :to => 'signatures#destroy', :via => :delete - end - module_function :add end \ No newline at end of file diff --git a/config/routes/sla.rb b/config/routes/sla.rb index 6b7d44f8b..900695e27 100644 --- a/config/routes/sla.rb +++ b/config/routes/sla.rb @@ -1,13 +1,11 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # slas - map.match api_path + '/slas', :to => 'slas#index', :via => :get - map.match api_path + '/slas/:id', :to => 'slas#show', :via => :get - map.match api_path + '/slas', :to => 'slas#create', :via => :post - map.match api_path + '/slas/:id', :to => 'slas#update', :via => :put - map.match api_path + '/slas/:id', :to => 'slas#destroy', :via => :delete + # slas + match api_path + '/slas', :to => 'slas#index', :via => :get + match api_path + '/slas/:id', :to => 'slas#show', :via => :get + match api_path + '/slas', :to => 'slas#create', :via => :post + match api_path + '/slas/:id', :to => 'slas#update', :via => :put + match api_path + '/slas/:id', :to => 'slas#destroy', :via => :delete - end - module_function :add end \ No newline at end of file diff --git a/config/routes/tag.rb b/config/routes/tag.rb index ebfa10d90..f37c59686 100644 --- a/config/routes/tag.rb +++ b/config/routes/tag.rb @@ -1,11 +1,9 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # links - map.match api_path + '/tags', :to => 'tags#list', :via => :get - map.match api_path + '/tags/add', :to => 'tags#add', :via => :get - map.match api_path + '/tags/remove', :to => 'tags#remove', :via => :get + # links + match api_path + '/tags', :to => 'tags#list', :via => :get + match api_path + '/tags/add', :to => 'tags#add', :via => :get + match api_path + '/tags/remove', :to => 'tags#remove', :via => :get - end - module_function :add -end +end \ No newline at end of file diff --git a/config/routes/taskbar.rb b/config/routes/taskbar.rb index 0721dd0ea..499bf2291 100644 --- a/config/routes/taskbar.rb +++ b/config/routes/taskbar.rb @@ -1,10 +1,10 @@ -module ExtraRoutes - def add(map, api_path) - map.match api_path + '/taskbar', :to => 'taskbar#index', :via => :get - map.match api_path + '/taskbar/:id', :to => 'taskbar#show', :via => :get - map.match api_path + '/taskbar', :to => 'taskbar#create', :via => :post - map.match api_path + '/taskbar/:id', :to => 'taskbar#update', :via => :put - map.match api_path + '/taskbar/:id', :to => 'taskbar#destroy',:via => :delete - end - module_function :add -end +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path + + match api_path + '/taskbar', :to => 'taskbar#index', :via => :get + match api_path + '/taskbar/:id', :to => 'taskbar#show', :via => :get + match api_path + '/taskbar', :to => 'taskbar#create', :via => :post + match api_path + '/taskbar/:id', :to => 'taskbar#update', :via => :put + match api_path + '/taskbar/:id', :to => 'taskbar#destroy',:via => :delete + +end \ No newline at end of file diff --git a/config/routes/template.rb b/config/routes/template.rb index 41d41e5c9..c0c5b0755 100644 --- a/config/routes/template.rb +++ b/config/routes/template.rb @@ -1,13 +1,11 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # templates - map.match api_path + '/templates', :to => 'templates#index', :via => :get - map.match api_path + '/templates/:id', :to => 'templates#show', :via => :get - map.match api_path + '/templates', :to => 'templates#create', :via => :post - map.match api_path + '/templates/:id', :to => 'templates#update', :via => :put - map.match api_path + '/templates/:id', :to => 'templates#destroy', :via => :delete + # templates + match api_path + '/templates', :to => 'templates#index', :via => :get + match api_path + '/templates/:id', :to => 'templates#show', :via => :get + match api_path + '/templates', :to => 'templates#create', :via => :post + match api_path + '/templates/:id', :to => 'templates#update', :via => :put + match api_path + '/templates/:id', :to => 'templates#destroy', :via => :delete - end - module_function :add end \ No newline at end of file diff --git a/config/routes/test.rb b/config/routes/test.rb index 75ebce01a..371c93ee2 100644 --- a/config/routes/test.rb +++ b/config/routes/test.rb @@ -1,10 +1,7 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do - map.match '/tests-core', :to => 'tests#core', :via => :get - map.match '/tests-form', :to => 'tests#form', :via => :get - map.match '/tests/wait/:sec', :to => 'tests#wait', :via => :get + match '/tests-core', :to => 'tests#core', :via => :get + match '/tests-form', :to => 'tests#form', :via => :get + match '/tests/wait/:sec', :to => 'tests#wait', :via => :get - end - module_function :add -end +end \ No newline at end of file diff --git a/config/routes/text_module.rb b/config/routes/text_module.rb index f165386ec..f57d864a5 100644 --- a/config/routes/text_module.rb +++ b/config/routes/text_module.rb @@ -1,13 +1,11 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # text_modules - map.match api_path + '/text_modules', :to => 'text_modules#index', :via => :get - map.match api_path + '/text_modules/:id', :to => 'text_modules#show', :via => :get - map.match api_path + '/text_modules', :to => 'text_modules#create', :via => :post - map.match api_path + '/text_modules/:id', :to => 'text_modules#update', :via => :put - map.match api_path + '/text_modules/:id', :to => 'text_modules#destroy', :via => :delete + # text_modules + match api_path + '/text_modules', :to => 'text_modules#index', :via => :get + match api_path + '/text_modules/:id', :to => 'text_modules#show', :via => :get + match api_path + '/text_modules', :to => 'text_modules#create', :via => :post + match api_path + '/text_modules/:id', :to => 'text_modules#update', :via => :put + match api_path + '/text_modules/:id', :to => 'text_modules#destroy', :via => :delete - end - module_function :add end \ No newline at end of file diff --git a/config/routes/ticket.rb b/config/routes/ticket.rb index 4e3297efa..f73b28e22 100644 --- a/config/routes/ticket.rb +++ b/config/routes/ticket.rb @@ -1,43 +1,41 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # tickets - map.match api_path + '/tickets/search', :to => 'tickets#search', :via => [:get, :post] - map.match api_path + '/tickets', :to => 'tickets#index', :via => :get - map.match api_path + '/tickets/:id', :to => 'tickets#show', :via => :get - map.match api_path + '/tickets', :to => 'tickets#create', :via => :post - map.match api_path + '/tickets/:id', :to => 'tickets#update', :via => :put - map.match api_path + '/ticket_create', :to => 'tickets#ticket_create', :via => :get - map.match api_path + '/ticket_full/:id', :to => 'tickets#ticket_full', :via => :get - map.match api_path + '/ticket_history/:id', :to => 'tickets#ticket_history', :via => :get - map.match api_path + '/ticket_customer', :to => 'tickets#ticket_customer', :via => :get - map.match api_path + '/ticket_merge_list/:ticket_id', :to => 'tickets#ticket_merge_list', :via => :get - map.match api_path + '/ticket_merge/:slave_ticket_id/:master_ticket_number', :to => 'tickets#ticket_merge', :via => :get + # tickets + match api_path + '/tickets/search', :to => 'tickets#search', :via => [:get, :post] + match api_path + '/tickets', :to => 'tickets#index', :via => :get + match api_path + '/tickets/:id', :to => 'tickets#show', :via => :get + match api_path + '/tickets', :to => 'tickets#create', :via => :post + match api_path + '/tickets/:id', :to => 'tickets#update', :via => :put + match api_path + '/ticket_create', :to => 'tickets#ticket_create', :via => :get + match api_path + '/ticket_full/:id', :to => 'tickets#ticket_full', :via => :get + match api_path + '/ticket_history/:id', :to => 'tickets#ticket_history', :via => :get + match api_path + '/ticket_customer', :to => 'tickets#ticket_customer', :via => :get + match api_path + '/ticket_merge_list/:ticket_id', :to => 'tickets#ticket_merge_list', :via => :get + match api_path + '/ticket_merge/:slave_ticket_id/:master_ticket_number', :to => 'tickets#ticket_merge', :via => :get - # ticket overviews - map.match api_path + '/ticket_overviews', :to => 'ticket_overviews#show', :via => :get + # ticket overviews + match api_path + '/ticket_overviews', :to => 'ticket_overviews#show', :via => :get - # ticket priority - map.match api_path + '/ticket_priorities', :to => 'ticket_priorities#index', :via => :get - map.match api_path + '/ticket_priorities/:id', :to => 'ticket_priorities#show', :via => :get - map.match api_path + '/ticket_priorities', :to => 'ticket_priorities#create', :via => :post - map.match api_path + '/ticket_priorities/:id', :to => 'ticket_priorities#update', :via => :put + # ticket priority + match api_path + '/ticket_priorities', :to => 'ticket_priorities#index', :via => :get + match api_path + '/ticket_priorities/:id', :to => 'ticket_priorities#show', :via => :get + match api_path + '/ticket_priorities', :to => 'ticket_priorities#create', :via => :post + match api_path + '/ticket_priorities/:id', :to => 'ticket_priorities#update', :via => :put - # ticket state - map.match api_path + '/ticket_states', :to => 'ticket_states#index', :via => :get - map.match api_path + '/ticket_states/:id', :to => 'ticket_states#show', :via => :get - map.match api_path + '/ticket_states', :to => 'ticket_states#create', :via => :post - map.match api_path + '/ticket_states/:id', :to => 'ticket_states#update', :via => :put + # ticket state + match api_path + '/ticket_states', :to => 'ticket_states#index', :via => :get + match api_path + '/ticket_states/:id', :to => 'ticket_states#show', :via => :get + match api_path + '/ticket_states', :to => 'ticket_states#create', :via => :post + match api_path + '/ticket_states/:id', :to => 'ticket_states#update', :via => :put - # ticket articles - map.match api_path + '/ticket_articles', :to => 'ticket_articles#index', :via => :get - map.match api_path + '/ticket_articles/:id', :to => 'ticket_articles#show', :via => :get - map.match api_path + '/ticket_articles', :to => 'ticket_articles#create', :via => :post - map.match api_path + '/ticket_articles/:id', :to => 'ticket_articles#update', :via => :put - map.match api_path + '/ticket_attachment/:ticket_id/:article_id/:id', :to => 'ticket_articles#attachment', :via => :get - map.match api_path + '/ticket_attachment_new', :to => 'ticket_articles#attachment_new', :via => :post - map.match api_path + '/ticket_article_plain/:id', :to => 'ticket_articles#article_plain', :via => :get + # ticket articles + match api_path + '/ticket_articles', :to => 'ticket_articles#index', :via => :get + match api_path + '/ticket_articles/:id', :to => 'ticket_articles#show', :via => :get + match api_path + '/ticket_articles', :to => 'ticket_articles#create', :via => :post + match api_path + '/ticket_articles/:id', :to => 'ticket_articles#update', :via => :put + match api_path + '/ticket_attachment/:ticket_id/:article_id/:id', :to => 'ticket_articles#attachment', :via => :get + match api_path + '/ticket_attachment_new', :to => 'ticket_articles#attachment_new', :via => :post + match api_path + '/ticket_article_plain/:id', :to => 'ticket_articles#article_plain', :via => :get - end - module_function :add -end +end \ No newline at end of file diff --git a/config/routes/translation.rb b/config/routes/translation.rb index 2ff531bfe..b20e6fc8b 100644 --- a/config/routes/translation.rb +++ b/config/routes/translation.rb @@ -1,12 +1,11 @@ -module ExtraRoutes - def add(map, api_path) - map.match api_path + '/translations', :to => 'translations#index', :via => :get - map.match api_path + '/translations/:id', :to => 'translations#show', :via => :get - map.match api_path + '/translations', :to => 'translations#create', :via => :post - map.match api_path + '/translations/:id', :to => 'translations#update', :via => :put - map.match api_path + '/translations/:id', :to => 'translations#destroy', :via => :delete +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - map.match api_path + '/translations/lang/:locale', :to => 'translations#load', :via => :get - end - module_function :add -end + match api_path + '/translations', :to => 'translations#index', :via => :get + match api_path + '/translations/:id', :to => 'translations#show', :via => :get + match api_path + '/translations', :to => 'translations#create', :via => :post + match api_path + '/translations/:id', :to => 'translations#update', :via => :put + match api_path + '/translations/:id', :to => 'translations#destroy', :via => :delete + + match api_path + '/translations/lang/:locale', :to => 'translations#load', :via => :get +end \ No newline at end of file diff --git a/config/routes/user.rb b/config/routes/user.rb index c963b2877..7fd3653d4 100644 --- a/config/routes/user.rb +++ b/config/routes/user.rb @@ -1,18 +1,16 @@ -module ExtraRoutes - def add(map, api_path) +Zammad::Application.routes.draw do + api_path = Rails.configuration.api_path - # users - map.match api_path + '/users/search', :to => 'users#search', :via => [:get, :post] - map.match api_path + '/users/password_reset', :to => 'users#password_reset_send', :via => :post - map.match api_path + '/users/password_reset_verify', :to => 'users#password_reset_verify', :via => :post - map.match api_path + '/users/password_change', :to => 'users#password_change', :via => :post - map.match api_path + '/users/preferences', :to => 'users#preferences', :via => :put - map.match api_path + '/users/account', :to => 'users#account_remove', :via => :delete - map.match api_path + '/users', :to => 'users#index', :via => :get - map.match api_path + '/users/:id', :to => 'users#show', :via => :get - map.match api_path + '/users', :to => 'users#create', :via => :post - map.match api_path + '/users/:id', :to => 'users#update', :via => :put + # users + match api_path + '/users/search', :to => 'users#search', :via => [:get, :post] + match api_path + '/users/password_reset', :to => 'users#password_reset_send', :via => :post + match api_path + '/users/password_reset_verify', :to => 'users#password_reset_verify', :via => :post + match api_path + '/users/password_change', :to => 'users#password_change', :via => :post + match api_path + '/users/preferences', :to => 'users#preferences', :via => :put + match api_path + '/users/account', :to => 'users#account_remove', :via => :delete + match api_path + '/users', :to => 'users#index', :via => :get + match api_path + '/users/:id', :to => 'users#show', :via => :get + match api_path + '/users', :to => 'users#create', :via => :post + match api_path + '/users/:id', :to => 'users#update', :via => :put - end - module_function :add end \ No newline at end of file