| @@ -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_\-]+(?<!\.atom)/ }, except: | |||
| [:new, :create, :index], path: "/") do | |||
| scope "/:owner/:repo" do | |||
| scope do | |||
| get( | |||
| '/activity', | |||
| to: 'project_trends#index', | |||
| as: :project_activity | |||
| ) | |||
| get( | |||
| '/branches', | |||
| to: 'projects#branches', | |||
| as: :project_branches | |||
| ) | |||
| get( | |||
| '/simple', | |||
| to: 'projects#simple', | |||
| as: :project_simple | |||
| ) | |||
| get( | |||
| '/watchers', | |||
| to: 'projects#watch_users', | |||
| as: :project_watchers | |||
| ) | |||
| get( | |||
| '/stargazers', | |||
| to: 'projects#praise_users', | |||
| as: :project_stargazers | |||
| ) | |||
| get( | |||
| '/members', | |||
| to: 'projects#fork_users', | |||
| as: :project_members | |||
| ) | |||
| end | |||
| resource :repositories, path: '/', only: [:show, :create, :edit] do | |||
| member do | |||
| get :activity | |||
| get :branches | |||
| get :simple | |||
| get :branches | |||
| post :watch | |||
| get :watch_users, :path => :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 | |||
| resource :repository, only: [:show, :create, :edit] do | |||
| member do | |||
| get 'archive' | |||
| get 'top_counts' | |||
| get 'entries' | |||
| get 'sub_entries' | |||
| get 'commits' | |||
| get 'tags' | |||
| 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 :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 | |||
| 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 :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 | |||
| 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 | |||
| resources :versions, :path => :milestones do | |||
| member do | |||
| post :update_status | |||
| end | |||
| scope do | |||
| get( | |||
| '/raw/*id', | |||
| to: 'raw#show', | |||
| constraints: { id: /.+/, format: /(html|js)/ }, | |||
| as: :raw | |||
| ) | |||
| end | |||
| resources :members, :path => :collaborators, only: [:index, :create] do | |||
| collection do | |||
| delete :remove | |||
| put :change_role | |||
| end | |||
| scope do | |||
| get( | |||
| '/blame/*id', | |||
| to: 'blame#show', | |||
| constraints: { id: /.+/, format: /(html|js)/ }, | |||
| as: :blame | |||
| ) | |||
| 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 | |||