routes.rb 4.0 KB
Newer Older
G
gitlabhq 已提交
1
Gitlab::Application.routes.draw do
2 3 4
  #
  # Search
  #
5
  get 'search' => "search#show"
V
Valery Sizov 已提交
6

A
Ariejan de Vroom 已提交
7
  # Optionally, enable Resque here
D
Dmitriy Zaporozhets 已提交
8 9
  require 'resque/server'
  mount Resque::Server.new, at: '/info/resque'
A
Ariejan de Vroom 已提交
10

11 12 13 14 15 16
  # Enable Grack support
  mount Grack::Bundle.new({
    git_path: GIT_OPTS['path'],
    project_root: GIT_HOST['base_path'],
    upload_pack: GIT_HOST['upload_pack'],
    receive_pack: GIT_HOST['receive_pack']
17
  }), at: '/:path', constraints: { path: /[\w-]+.git*/ }
18

19 20 21
  #
  # Help
  #
22
  get 'help' => 'help#index'
23 24
  get 'help/permissions' => 'help#permissions'
  get 'help/workflow' => 'help#workflow'
25
  get 'help/web_hooks' => 'help#web_hooks'
26

27 28 29
  #
  # Admin Area
  #
N
Nihad Abbasov 已提交
30
  namespace :admin do
31 32
    resources :users do
      member do
D
Dmitriy Zaporozhets 已提交
33
        put :team_update
34 35
        put :block
        put :unblock
D
Dmitriy Zaporozhets 已提交
36 37
      end
    end
38 39
    resources :projects, :constraints => { :id => /[^\/]+/ } do
      member do
40 41 42 43
        get :team
        put :team_update
      end
    end
D
Dmitriy Zaporozhets 已提交
44
    resources :team_members, :only => [:edit, :update, :destroy]
G
gitlabhq 已提交
45 46 47 48
    get 'emails', :to => 'mailer#preview'
    get 'mailer/preview_note'
    get 'mailer/preview_user_new'
    get 'mailer/preview_issue_new'
R
randx 已提交
49
    root :to => "dashboard#index"
G
gitlabhq 已提交
50 51
  end

52
  get "errors/githost"
R
randx 已提交
53 54 55 56

  #
  # Profile Area
  #
G
gitlabhq 已提交
57 58
  get "profile/password", :to => "profile#password"
  put "profile/password", :to => "profile#password_update"
59
  get "profile/token", :to => "profile#token"
60
  put "profile/reset_private_token", :to => "profile#reset_private_token"
G
gitlabhq 已提交
61
  get "profile", :to => "profile#show"
62 63
  get "profile/design", :to => "profile#design"
  put "profile/update", :to => "profile#update"
64
  resources :keys
D
Dmitriy Zaporozhets 已提交
65

R
randx 已提交
66 67 68 69
  #
  # Dashboard Area
  #
  get "dashboard", :to => "dashboard#index"
D
Dmitriy Zaporozhets 已提交
70 71
  get "dashboard/issues", :to => "dashboard#issues"
  get "dashboard/merge_requests", :to => "dashboard#merge_requests"
G
gitlabhq 已提交
72

R
randx 已提交
73
  resources :projects, :constraints => { :id => /[^\/]+/ }, :only => [:new, :create]
74

V
vsizov 已提交
75
  devise_for :users, :controllers => { :omniauth_callbacks => :omniauth_callbacks }
G
gitlabhq 已提交
76

77 78 79
  #
  # Project Area
  #
80
  resources :projects, :constraints => { :id => /[^\/]+/ }, :except => [:new, :create, :index], :path => "/" do
N
Nihad Abbasov 已提交
81
    member do
G
gitlabhq 已提交
82 83
      get "team"
      get "wall"
V
Valery Sizov 已提交
84
      get "graph"
85
      get "files"
G
gitlabhq 已提交
86
    end
G
gitlabhq 已提交
87

V
Valery Sizov 已提交
88 89
    resources :wikis, :only => [:show, :edit, :destroy, :create] do
      member do
90
        get "history"
V
Valery Sizov 已提交
91 92
      end
    end
V
Valery Sizov 已提交
93

94 95
    resource :repository do
      member do
D
Dmitriy Zaporozhets 已提交
96 97
        get "branches"
        get "tags"
98
        get "archive"
D
Dmitriy Zaporozhets 已提交
99 100
      end
    end
101

M
miks 已提交
102
    resources :deploy_keys
103
    resources :protected_branches, :only => [:index, :create, :destroy]
M
miks 已提交
104

105 106
    resources :refs, :only => [], :path => "/" do
      collection do
G
gitlabhq 已提交
107 108 109
        get "switch"
      end

110
      member do
G
gitlabhq 已提交
111
        get "tree", :constraints => { :id => /[a-zA-Z.\/0-9_\-]+/ }
112
        get "blob",
G
gitlabhq 已提交
113 114 115 116 117
          :constraints => {
            :id => /[a-zA-Z.0-9\/_\-]+/,
            :path => /.*/
          }

G
gitlabhq 已提交
118

G
gitlabhq 已提交
119 120 121 122
        # tree viewer
        get "tree/:path" => "refs#tree",
          :as => :tree_file,
          :constraints => {
G
gitlabhq 已提交
123
            :id => /[a-zA-Z.0-9\/_\-]+/,
G
gitlabhq 已提交
124 125
            :path => /.*/
          }
126 127 128 129 130 131 132 133

        # blame
        get "blame/:path" => "refs#blame",
          :as => :blame_file,
          :constraints => {
            :id => /[a-zA-Z.0-9\/_\-]+/,
            :path => /.*/
          }
G
gitlabhq 已提交
134
      end
G
gitlabhq 已提交
135
    end
G
gitlabhq 已提交
136

137 138
    resources :merge_requests do
      member do
139
        get :diffs
R
randx 已提交
140
        get :automerge
V
Valery Sizov 已提交
141
        get :automerge_check
142
      end
143

144
      collection do
145 146 147
        get :branch_from
        get :branch_to
      end
148
    end
149 150 151

    resources :snippets do
      member do
R
randx 已提交
152 153 154 155
        get "raw"
      end
    end

156 157
    resources :hooks, :only => [:index, :create, :destroy] do
      member do
158 159 160
        get :test
      end
    end
161 162
    resources :commits do
      collection do
D
Dmitriy Zaporozhets 已提交
163 164
        get :compare
      end
165

166
      member do
167 168
        get :patch
      end
D
Dmitriy Zaporozhets 已提交
169
    end
G
gitlabhq 已提交
170
    resources :team_members
D
Dmitriy Zaporozhets 已提交
171
    resources :milestones
V
VSizov 已提交
172 173
    resources :issues do
      collection do
174 175
        post  :sort
        get   :search
A
Adam Leonard 已提交
176
      end
V
VSizov 已提交
177
    end
178
    resources :notes, :only => [:index, :create, :destroy]
G
gitlabhq 已提交
179
  end
R
randx 已提交
180
  root :to => "dashboard#index"
G
gitlabhq 已提交
181
end