group.rb 2.7 KB
Newer Older
1 2 3
resources :groups, only: [:index, :new, :create] do
  post :preview_markdown
end
4

5
constraints(::Constraints::GroupUrlConstrainer.new) do
V
Valery Sizov 已提交
6 7 8
  scope(path: 'groups/*id',
        controller: :groups,
        constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ }) do
9 10 11 12 13 14
    scope(path: '-') do
      get :edit, as: :edit_group
      get :issues, as: :issues_group
      get :merge_requests, as: :merge_requests_group
      get :projects, as: :projects_group
      get :activity, as: :activity_group
15
      put :transfer, as: :transfer_group
16 17
    end

V
Valery Sizov 已提交
18
    get '/', action: :show, as: :group_canonical
19
  end
D
Dmitriy Zaporozhets 已提交
20

21
  scope(path: 'groups/*group_id/-',
V
Valery Sizov 已提交
22 23 24
        module: :groups,
        as: :group,
        constraints: { group_id: Gitlab::PathRegex.full_namespace_route_regex }) do
25 26
    namespace :settings do
      resource :ci_cd, only: [:show], controller: 'ci_cd'
27
      resources :badges, only: [:index]
28
    end
29

30
    resource :variables, only: [:show, :update]
D
Dmitriy Zaporozhets 已提交
31

32
    resources :children, only: [:index]
B
Bob Van Landuyt 已提交
33
    resources :shared_projects, only: [:index]
B
Bob Van Landuyt 已提交
34

35 36 37
    resources :labels, except: [:show] do
      post :toggle_subscription, on: :member
    end
38

39
    resources :milestones, constraints: { id: %r{[^/]+} }, only: [:index, :show, :edit, :update, :new, :create] do
40 41 42 43
      member do
        get :merge_requests
        get :participants
        get :labels
44
      end
45
    end
46

47
    resource :avatar, only: [:destroy]
48

49 50 51
    resources :group_members, only: [:index, :create, :update, :destroy], concerns: :access_requestable do
      post :resend_invite, on: :member
      delete :leave, on: :collection
V
Valery Sizov 已提交
52
    end
J
Jarka Kadlecova 已提交
53 54 55

    resources :uploads, only: [:create] do
      collection do
56
        get ":secret/:filename", action: :show, as: :show, constraints: { filename: %r{[^/]+} }
J
Jarka Kadlecova 已提交
57 58
      end
    end
F
Felipe Artur 已提交
59 60 61

    # On CE only index and show actions are needed
    resources :boards, only: [:index, :show]
62 63 64 65 66 67 68

    resources :runners, only: [:index, :edit, :update, :destroy, :show] do
      member do
        post :resume
        post :pause
      end
    end
V
Valery Sizov 已提交
69
  end
70 71 72 73 74 75 76 77 78 79

  scope(path: '*id',
        as: :group,
        constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ },
        controller: :groups) do
    get '/', action: :show
    patch '/', action: :update
    put '/', action: :update
    delete '/', action: :destroy
  end
B
Bob Van Landuyt 已提交
80 81 82 83

  # Legacy paths should be defined last, so they would be ignored if routes with
  # one of the previously reserved words exist.
  scope(path: 'groups/*group_id') do
84 85 86
    Gitlab::Routing.redirect_legacy_paths(self, :labels, :milestones, :group_members,
                                          :edit, :issues, :merge_requests, :projects,
                                          :activity)
B
Bob Van Landuyt 已提交
87
  end
88
end