summaryrefslogtreecommitdiff
path: root/config/routes.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-11-14 16:55:31 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-11-23 14:08:36 +0200
commit6683fdcfb0ae4ceb368b6f5f63dde0a10a4a3e1b (patch)
tree7530562c2e0702df3e74fc8ca8288e2e3f4ef0a2 /config/routes.rb
parentb1b5060dbad15975184ec20a1914c7c48fc804db (diff)
downloadgitlab-ce-6683fdcfb0ae4ceb368b6f5f63dde0a10a4a3e1b.tar.gz
Add nested groups support to the routingdz-allow-nested-group-routing
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'config/routes.rb')
-rw-r--r--config/routes.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/config/routes.rb b/config/routes.rb
index 7bf6c03e69b..03b47261e7e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,6 +1,7 @@
require 'sidekiq/web'
require 'sidekiq/cron/web'
require 'api/api'
+require 'constraints/group_url_constrainer'
Rails.application.routes.draw do
concern :access_requestable do
@@ -78,10 +79,21 @@ Rails.application.routes.draw do
draw :user
draw :project
- # Get all keys of user
- get ':username.keys' => 'profiles/keys#get_keys', constraints: { username: /.*/ }
-
root to: "root#index"
- get '*unmatched_route', to: 'application#not_found'
+ # Since group show page is wildcard routing
+ # we want all other routing to be checked before matching this one
+ constraints(GroupUrlConstrainer.new) do
+ scope(path: '*id',
+ as: :group,
+ constraints: { id: Gitlab::Regex.namespace_route_regex, format: /(html|json|atom)/ },
+ controller: :groups) do
+ get '/', action: :show
+ patch '/', action: :update
+ put '/', action: :update
+ delete '/', action: :destroy
+ end
+ end
+
+ get '*unmatched_route', to: 'application#route_not_found'
end