diff --git a/config/routes.rb b/config/routes.rb index 8f61f0477..6a1f91174 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -82,134 +82,158 @@ Rails.application.routes.draw do end # Project Area START - resources :namespaces, path: '/', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: [] do - resources(:projects, constraints: { id: /[a-zA-Z.0-9_\-]+(? :watchers - get :praise_users, :path => :stargazers - get :fork_users, :path => :members + get 'archive' + get 'top_counts' + get 'entries' + get 'sub_entries' + get 'commits' + get 'tags' + end + end + + resources :issues do + collection do + get :commit_issues + get :index_chosen + post :clean + post :series_update + end + member do + post :copy + post :close_issue + post :lock_issue + end + end + + resources :pull_requests, :path => :pulls, except: [:destroy] do + member do + post :pr_merge + # post :check_merge + post :refuse_merge + end + collection do + post :check_can_merge + get :create_merge_infos + get :get_branches + end + end + + resources :versions, :path => :milestones do + member do + post :update_status + end + end + + resources :members, :path => :collaborators, only: [:index, :create] do + collection do + delete :remove + put :change_role + end + end + + resources :hooks + resources :forks, only: [:create] + resources :project_trends, :path => :activity, only: [:index, :create] + resources :issue_tags, :path => :labels, only: [:create, :edit, :update, :destroy, :index] + resources :version_releases, :path => :releases, only: [:index,:new, :create, :edit, :update, :destroy] + + scope module: :projects do + scope do + get( + '/blob/*id/diff', + to: 'blob#diff', + constraints: { id: /.+/, format: false }, + as: :blob_diff + ) + get( + '/blob/*id', + to: 'blob#show', + constraints: { id: /.+/, format: false }, + as: :blob + ) + delete( + '/blob/*id', + to: 'blob#destroy', + constraints: { id: /.+/, format: false } + ) + put( + '/blob/*id', + to: 'blob#update', + constraints: { id: /.+/, format: false } + ) + post( + '/blob/*id', + to: 'blob#create', + constraints: { id: /.+/, format: false } + ) end - resource :repository, only: [:show, :create, :edit] do - member do - get 'archive' - get 'top_counts' - get 'entries' - get 'sub_entries' - get 'commits' - get 'tags' - end + scope do + get( + '/raw/*id', + to: 'raw#show', + constraints: { id: /.+/, format: /(html|js)/ }, + as: :raw + ) end - resources :issues do - collection do - get :commit_issues - get :index_chosen - post :clean - post :series_update - end - member do - post :copy - post :close_issue - post :lock_issue - end + scope do + get( + '/blame/*id', + to: 'blame#show', + constraints: { id: /.+/, format: /(html|js)/ }, + as: :blame + ) end - resources :pull_requests, :path => :pulls, except: [:destroy] do - member do - post :pr_merge - # post :check_merge - post :refuse_merge - end - collection do - post :check_can_merge - get :create_merge_infos - get :get_branches - end - end - - resources :versions, :path => :milestones do - member do - post :update_status - end - end - - resources :members, :path => :collaborators, only: [:index, :create] do - collection do - delete :remove - put :change_role - end - end - - resources :hooks - resources :forks, only: [:create] - resources :project_trends, :path => :activity, only: [:index, :create] - resources :issue_tags, :path => :labels, only: [:create, :edit, :update, :destroy, :index] - resources :version_releases, :path => :releases, only: [:index,:new, :create, :edit, :update, :destroy] - - scope module: :projects do - scope do - get( - '/blob/*id/diff', - to: 'blob#diff', - constraints: { id: /.+/, format: false }, - as: :blob_diff - ) - get( - '/blob/*id', - to: 'blob#show', - constraints: { id: /.+/, format: false }, - as: :blob - ) - delete( - '/blob/*id', - to: 'blob#destroy', - constraints: { id: /.+/, format: false } - ) - put( - '/blob/*id', - to: 'blob#update', - constraints: { id: /.+/, format: false } - ) - post( - '/blob/*id', - to: 'blob#create', - constraints: { id: /.+/, format: false } - ) - end - - scope do - get( - '/raw/*id', - to: 'raw#show', - constraints: { id: /.+/, format: /(html|js)/ }, - as: :raw - ) - end - - scope do - get( - '/blame/*id', - to: 'blame#show', - constraints: { id: /.+/, format: /(html|js)/ }, - as: :blame - ) - end - - scope do - get( - '/tree/*id', - to: 'tree#show', - constraints: { id: /.+/, format: /(html|js)/ }, - as: :tree - ) - end + scope do + get( + '/tree/*id', + to: 'tree#show', + constraints: { id: /.+/, format: /(html|js)/ }, + as: :tree + ) end end end