diff options
Diffstat (limited to 'config/routes/project.rb')
-rw-r--r-- | config/routes/project.rb | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/config/routes/project.rb b/config/routes/project.rb index b4ebc7df4fe..63f9c99b10e 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -2,7 +2,7 @@ resources :projects, only: [:index, :new, :create] draw :git_http -get '/projects/:id' => 'projects#resolve' +get "/projects/:id" => "projects#resolve" constraints(::Constraints::ProjectUrlConstrainer.new) do # If the route has a wildcard segment, the segment has a regex constraint, @@ -18,33 +18,33 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do # `:project_id`, or `*id`. # # See https://github.com/rails/rails/blob/v4.2.8/actionpack/lib/action_dispatch/routing/mapper.rb#L155 - scope(path: '*namespace_id', + scope(path: "*namespace_id", as: :namespace, namespace_id: Gitlab::PathRegex.full_namespace_route_regex) do - scope(path: ':project_id', - constraints: { project_id: Gitlab::PathRegex.project_route_regex }, + scope(path: ":project_id", + constraints: {project_id: Gitlab::PathRegex.project_route_regex}, module: :projects, as: :project) do resources :autocomplete_sources, only: [] do collection do - get 'members' - get 'issues' - get 'merge_requests' - get 'labels' - get 'milestones' - get 'commands' - get 'snippets' + get "members" + get "issues" + get "merge_requests" + get "labels" + get "milestones" + get "commands" + get "snippets" end end # # Templates # - get '/templates/:template_type/:key' => 'templates#show', as: :template, constraints: { key: %r{[^/]+} } + get "/templates/:template_type/:key" => "templates#show", :as => :template, :constraints => {key: %r{[^/]+}} resource :avatar, only: [:show, :destroy] - resources :commit, only: [:show], constraints: { id: /\h{7,40}/ } do + resources :commit, only: [:show], constraints: {id: /\h{7,40}/} do member do get :branches get :pipelines @@ -56,21 +56,21 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end resource :pages, only: [:show, :update, :destroy] do - resources :domains, except: :index, controller: 'pages_domains', constraints: { id: %r{[^/]+} } do + resources :domains, except: :index, controller: "pages_domains", constraints: {id: %r{[^/]+}} do member do post :verify end end end - resources :snippets, concerns: :awardable, constraints: { id: /\d+/ } do + resources :snippets, concerns: :awardable, constraints: {id: /\d+/} do member do get :raw post :mark_as_spam end end - resources :services, constraints: { id: %r{[^/]+} }, only: [:edit, :update] do + resources :services, constraints: {id: %r{[^/]+}}, only: [:edit, :update] do member do put :test end @@ -79,19 +79,19 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do resource :mattermost, only: [:new, :create] namespace :prometheus do - resources :metrics, constraints: { id: %r{[^\/]+} }, only: [] do + resources :metrics, constraints: {id: %r{[^\/]+}}, only: [] do get :active_common, on: :collection end end - resources :deploy_keys, constraints: { id: /\d+/ }, only: [:index, :new, :create, :edit, :update] do + resources :deploy_keys, constraints: {id: /\d+/}, only: [:index, :new, :create, :edit, :update] do member do put :enable put :disable end end - resources :deploy_tokens, constraints: { id: /\d+/ }, only: [] do + resources :deploy_tokens, constraints: {id: /\d+/}, only: [] do member do put :revoke end @@ -101,7 +101,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do resources :forks, only: [:index, :new, :create] resource :import, only: [:new, :create, :show] - resources :merge_requests, concerns: :awardable, except: [:new, :create], constraints: { id: /\d+/ } do + resources :merge_requests, concerns: :awardable, except: [:new, :create], constraints: {id: /\d+/} do member do get :commit_change_content post :merge @@ -115,21 +115,21 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do post :rebase get :test_reports - scope constraints: { format: nil }, action: :show do - get :commits, defaults: { tab: 'commits' } - get :pipelines, defaults: { tab: 'pipelines' } - get :diffs, defaults: { tab: 'diffs' } + scope constraints: {format: nil}, action: :show do + get :commits, defaults: {tab: "commits"} + get :pipelines, defaults: {tab: "pipelines"} + get :diffs, defaults: {tab: "diffs"} end - scope constraints: { format: 'json' }, as: :json do + scope constraints: {format: "json"}, as: :json do get :commits get :pipelines - get :diffs, to: 'merge_requests/diffs#show' + get :diffs, to: "merge_requests/diffs#show" end - get :diff_for_path, controller: 'merge_requests/diffs' + get :diff_for_path, controller: "merge_requests/diffs" - scope controller: 'merge_requests/conflicts' do + scope controller: "merge_requests/conflicts" do get :conflicts, action: :show get :conflict_for_path post :resolve_conflicts @@ -141,7 +141,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do post :bulk_update end - resources :discussions, only: [:show], constraints: { id: /\h{40}/ } do + resources :discussions, only: [:show], constraints: {id: /\h{40}/} do member do post :resolve delete :resolve, action: :unresolve @@ -149,18 +149,18 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end end - scope path: 'merge_requests', controller: 'merge_requests/creations' do - post '', action: :create, as: nil + scope path: "merge_requests", controller: "merge_requests/creations" do + post "", action: :create, as: nil - scope path: 'new', as: :new_merge_request do - get '', action: :new + scope path: "new", as: :new_merge_request do + get "", action: :new - scope constraints: { format: nil }, action: :new do - get :diffs, defaults: { tab: 'diffs' } - get :pipelines, defaults: { tab: 'pipelines' } + scope constraints: {format: nil}, action: :new do + get :diffs, defaults: {tab: "diffs"} + get :pipelines, defaults: {tab: "pipelines"} end - scope constraints: { format: 'json' }, as: :json do + scope constraints: {format: "json"}, as: :json do get :diffs get :pipelines end @@ -181,14 +181,14 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do resource :mirror, only: [:show, :update] do member do - get :ssh_host_keys, constraints: { format: :json } + get :ssh_host_keys, constraints: {format: :json} post :update_now end end resources :pipelines, only: [:index, :new, :create, :show] do collection do - resource :pipelines_settings, path: 'settings', only: [:show, :update] + resource :pipelines_settings, path: "settings", only: [:show, :update] get :charts end @@ -218,12 +218,12 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do get :terminal get :metrics get :additional_metrics - get '/terminal.ws/authorize', to: 'environments#terminal_websocket_authorize', constraints: { format: nil } + get "/terminal.ws/authorize", to: "environments#terminal_websocket_authorize", constraints: {format: nil} end collection do get :metrics, action: :metrics_redirect - get :folder, path: 'folders/*id', constraints: { format: /(html|json)/ } + get :folder, path: "folders/*id", constraints: {format: /(html|json)/} get :search end @@ -238,7 +238,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do resource :cycle_analytics, only: [:show] namespace :cycle_analytics do - scope :events, controller: 'events' do + scope :events, controller: "events" do get :issue get :plan get :code @@ -250,19 +250,19 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end namespace :serverless do - get '/functions/:environment_id/:id', to: 'functions#show' + get "/functions/:environment_id/:id", to: "functions#show" resources :functions, only: [:index] end - scope '-' do - get 'archive/*id', constraints: { format: Gitlab::PathRegex.archive_formats_regex, id: /.+?/ }, to: 'repositories#archive', as: 'archive' + scope "-" do + get "archive/*id", constraints: {format: Gitlab::PathRegex.archive_formats_regex, id: /.+?/}, to: "repositories#archive", as: "archive" - resources :jobs, only: [:index, :show], constraints: { id: /\d+/ } do + resources :jobs, only: [:index, :show], constraints: {id: /\d+/} do collection do resources :artifacts, only: [] do collection do get :latest_succeeded, - path: '*ref_name_and_path', + path: "*ref_name_and_path", format: false end end @@ -275,17 +275,17 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do post :retry post :play post :erase - get :trace, defaults: { format: 'json' } + get :trace, defaults: {format: "json"} get :raw get :terminal - get '/terminal.ws/authorize', to: 'jobs#terminal_websocket_authorize', constraints: { format: nil } + get "/terminal.ws/authorize", to: "jobs#terminal_websocket_authorize", constraints: {format: nil} end resource :artifacts, only: [] do get :download - get :browse, path: 'browse(/*path)', format: false - get :file, path: 'file/*path', format: false - get :raw, path: 'raw/*path', format: false + get :browse, path: "browse(/*path)", format: false + get :file, path: "file/*path", format: false + get :raw, path: "raw/*path", format: false post :keep end end @@ -297,7 +297,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do draw :legacy_builds - resources :hooks, only: [:index, :create, :edit, :update, :destroy], constraints: { id: /\d+/ } do + resources :hooks, only: [:index, :create, :edit, :update, :destroy], constraints: {id: /\d+/} do member do post :test end @@ -310,7 +310,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end resources :container_registry, only: [:index, :destroy], - controller: 'registry/repositories' + controller: "registry/repositories" namespace :registry do resources :repository, only: [] do @@ -319,12 +319,12 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do # in JSON format, or a request for tag named `latest.json`. scope format: false do resources :tags, only: [:index, :destroy], - constraints: { id: Gitlab::Regex.container_registry_tag_regex } + constraints: {id: Gitlab::Regex.container_registry_tag_regex} end end end - resources :milestones, constraints: { id: /\d+/ } do + resources :milestones, constraints: {id: /\d+/} do member do post :promote put :sort_issues @@ -335,7 +335,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end end - resources :labels, except: [:show], constraints: { id: /\d+/ } do + resources :labels, except: [:show], constraints: {id: /\d+/} do collection do post :generate post :set_priorities @@ -348,8 +348,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end end - get :issues, to: 'issues#calendar', constraints: lambda { |req| req.format == :ics } - resources :issues, concerns: :awardable, constraints: { id: /\d+/ } do + get :issues, to: "issues#calendar", constraints: lambda { |req| req.format == :ics } + resources :issues, concerns: :awardable, constraints: {id: /\d+/} do member do post :toggle_subscription post :mark_as_spam @@ -367,7 +367,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end end - resources :project_members, except: [:show, :new, :edit], constraints: { id: %r{[a-zA-Z./0-9_\-#%+]+} }, concerns: :access_requestable do + resources :project_members, except: [:show, :new, :edit], constraints: {id: %r{[a-zA-Z./0-9_\-#%+]+}}, concerns: :access_requestable do collection do delete :leave @@ -382,9 +382,9 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end end - resources :group_links, only: [:index, :create, :update, :destroy], constraints: { id: /\d+/ } + resources :group_links, only: [:index, :create, :update, :destroy], constraints: {id: /\d+/} - resources :notes, only: [:create, :destroy, :update], concerns: :awardable, constraints: { id: /\d+/ } do + resources :notes, only: [:create, :destroy, :update], concerns: :awardable, constraints: {id: /\d+/} do member do delete :delete_attachment post :resolve @@ -392,7 +392,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end end - get 'noteable/:target_type/:target_id/notes' => 'notes#index', as: 'noteable_notes' + get "noteable/:target_type/:target_id/notes" => "notes#index", :as => "noteable_notes" # On CE only index and show are needed resources :boards, only: [:index, :show] @@ -401,7 +401,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do resources :uploads, only: [:create] do collection do - get ":secret/:filename", action: :show, as: :show, constraints: { filename: %r{[^/]+} } + get ":secret/:filename", action: :show, as: :show, constraints: {filename: %r{[^/]+}} post :authorize end end @@ -421,7 +421,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do resources :runner_projects, only: [:create, :destroy] resources :badges, only: [:index] do collection do - scope '*ref', constraints: { ref: Gitlab::PathRegex.git_reference_regex } do + scope "*ref", constraints: {ref: Gitlab::PathRegex.git_reference_regex} do constraints format: /svg/ do # Keep around until 10.0, see gitlab-org/gitlab-ce#35307 get :build, to: "badges#pipeline" @@ -433,13 +433,13 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end namespace :settings do get :members, to: redirect("%{namespace_id}/%{project_id}/project_members") - resource :ci_cd, only: [:show, :update], controller: 'ci_cd' do + resource :ci_cd, only: [:show, :update], controller: "ci_cd" do post :reset_cache put :reset_registration_token end resource :integrations, only: [:show] resource :repository, only: [:show], controller: :repository do - post :create_deploy_token, path: 'deploy_token/create' + post :create_deploy_token, path: "deploy_token/create" post :cleanup end end @@ -461,9 +461,9 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end resources(:projects, - path: '/', - constraints: { id: Gitlab::PathRegex.project_route_regex }, - only: [:edit, :show, :update, :destroy]) do + path: "/", + constraints: {id: Gitlab::PathRegex.project_route_regex}, + only: [:edit, :show, :update, :destroy]) do member do put :transfer delete :remove_fork |