routes.rb revision a4344d37747b6733bbd0d8df738b614cb385316c
76b43e4417bab52e913da39b5f5bc2a130d3f149Timo Sirainenrequire 'sidekiq/web' if defined? Sidekiq
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainenrequire Rails.root.join('lib', 'router_constraints.rb')
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo SirainenSpecroutes.define(Ontohub::Application.routes) do
ffd9a1898a18fadfc5dce399162c25d50548f905Timo Sirainen
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :filetypes, only: :create
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen # IRI Routing #
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen ###############
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen #
a2f250a332dfc1e6cd4ffd196c621eb9dbf7b8a1Timo Sirainen
2d49f150b4bce6f2f59a84e268e4777901c3e42cTimo Sirainen get ':repository_id(/*path)/:file',
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen controller: :ontologies,
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen action: :show,
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen as: :ontology_iri,
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen constraints: GroupedConstraint.new(
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen IRIRouterConstraint.new,
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen MIMERouterConstraint.new('text/plain', 'text/html'))
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen get 'ref/:version_number/:repository_id(/*path)/:file',
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen controller: :ontologies,
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen action: :show,
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen as: :versioned_ontology_iri,
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen constraints: GroupedConstraint.new(
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen RefIRIRouterConstraint.new,
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen MIMERouterConstraint.new('text/plain', 'text/html'))
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen #
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen ###############
221351ed85c839e0b03d82c47654c3d17202e3dbTimo Sirainen
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :ontology_types, only: :show
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen get '/after_signup', to: 'home#show' , as: 'after_sign_up'
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen devise_for :users, controllers: {
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen confirmations: 'users/confirmations',
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen registrations: 'users/registrations'
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen }
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :users, only: :show
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :keys, except: [:show, :edit, :update]
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :logics, only: [:index, :show] do
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :supports, :only => [:create, :update, :destroy, :index]
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :graphs, :only => [:index]
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen end
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :languages do
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :supports, :only => [:create, :update, :destroy, :index]
7ded22760598b78ee29f9418eacc0abe3fb51055Timo Sirainen end
7ded22760598b78ee29f9418eacc0abe3fb51055Timo Sirainen
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :language_mappings
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :logic_mappings
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :mappings, only: :index
7ded22760598b78ee29f9418eacc0abe3fb51055Timo Sirainen
7ded22760598b78ee29f9418eacc0abe3fb51055Timo Sirainen resources :categories, :only => [:index, :show]
7ded22760598b78ee29f9418eacc0abe3fb51055Timo Sirainen resources :projects
7ded22760598b78ee29f9418eacc0abe3fb51055Timo Sirainen resources :tasks
7ded22760598b78ee29f9418eacc0abe3fb51055Timo Sirainen resources :license_models
7ded22760598b78ee29f9418eacc0abe3fb51055Timo Sirainen resources :formality_levels
7ded22760598b78ee29f9418eacc0abe3fb51055Timo Sirainen
7ded22760598b78ee29f9418eacc0abe3fb51055Timo Sirainen
7ded22760598b78ee29f9418eacc0abe3fb51055Timo Sirainen resources :language_adjoints
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :logic_adjoints
7ded22760598b78ee29f9418eacc0abe3fb51055Timo Sirainen
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :serializations
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen
8ababf3e7b15f793370d1dedf85825d38b42633fTimo Sirainen namespace :admin do
cfa9359fbd6a967ccdcd553c5e483a093885ab6fTimo Sirainen resources :teams, :only => :index
cfa9359fbd6a967ccdcd553c5e483a093885ab6fTimo Sirainen resources :users
cfa9359fbd6a967ccdcd553c5e483a093885ab6fTimo Sirainen resources :jobs, :only => :index
cfa9359fbd6a967ccdcd553c5e483a093885ab6fTimo Sirainen resources :status, only: :index
cfa9359fbd6a967ccdcd553c5e483a093885ab6fTimo Sirainen end
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen
3675a7e9bd3775ba13fe8bc93915902513a0f1a4Timo Sirainen authenticate :user, lambda { |u| u.admin? } do
3675a7e9bd3775ba13fe8bc93915902513a0f1a4Timo Sirainen mount Sidekiq::Web => 'admin/sidekiq'
3675a7e9bd3775ba13fe8bc93915902513a0f1a4Timo Sirainen end
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen namespace :api, defaults: { format: 'json' } do
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen namespace :v1 do
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :categories, only: [:index]
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :repositories, only: [:index, :update]
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :ontologies, only: [:index, :update]
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen end
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen end
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :ontologies, only: [:index] do
7ded22760598b78ee29f9418eacc0abe3fb51055Timo Sirainen collection do
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen get 'search' => 'ontology_search#search'
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen end
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen end
cfa9359fbd6a967ccdcd553c5e483a093885ab6fTimo Sirainen
8ababf3e7b15f793370d1dedf85825d38b42633fTimo Sirainen resources :mappings do
8ababf3e7b15f793370d1dedf85825d38b42633fTimo Sirainen get 'update_version', :on => :member
3675a7e9bd3775ba13fe8bc93915902513a0f1a4Timo Sirainen end
3675a7e9bd3775ba13fe8bc93915902513a0f1a4Timo Sirainen
3675a7e9bd3775ba13fe8bc93915902513a0f1a4Timo Sirainen resources :teams do
3675a7e9bd3775ba13fe8bc93915902513a0f1a4Timo Sirainen resources :permissions, :only => [:index], :controller => 'teams/permissions'
3675a7e9bd3775ba13fe8bc93915902513a0f1a4Timo Sirainen resources :team_users, :only => [:index, :create, :update, :destroy], :path => 'users'
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen end
3675a7e9bd3775ba13fe8bc93915902513a0f1a4Timo Sirainen
3675a7e9bd3775ba13fe8bc93915902513a0f1a4Timo Sirainen get 'autocomplete' => 'autocomplete#index'
3675a7e9bd3775ba13fe8bc93915902513a0f1a4Timo Sirainen get 'symbols_search' => 'symbols_search#index'
3675a7e9bd3775ba13fe8bc93915902513a0f1a4Timo Sirainen
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :repositories do
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :s_s_h_access, :only => :index, path: 'ssh_access'
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :permissions, :only => [:index, :create, :update, :destroy]
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :url_maps, except: :show
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :errors, :only => :index
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :repository_settings, :only => :index
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen resources :ontologies, only: [:index, :show, :edit, :update, :destroy] do
2a34e2be33f8a17d21384a5527ed9f75f4d270e0Timo Sirainen collection do
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen post 'retry_failed' => 'ontologies#retry_failed'
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen get 'search' => 'ontology_search#search'
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen end
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen member do
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen post 'retry_failed' => 'ontologies#retry_failed'
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen end
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen resources :children, :only => :index
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen resources :symbols, only: :index
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen resources :sentences, :only => :index
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen resources :theorems, only: :index
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen resources :mappings do
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen get 'update_version', :on => :member
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen end
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen resources :ontology_versions, :only => [:index, :show, :new, :create], :path => 'versions' do
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen resource :oops_request, :only => [:show, :create]
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen end
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen resources :categories
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen resources :tasks
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen resources :license_models
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen resources :tools
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen resources :projects
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen resources :metadata, :only => [:index, :create, :destroy]
8ababf3e7b15f793370d1dedf85825d38b42633fTimo Sirainen resources :comments, :only => [:index, :create, :destroy]
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen resources :graphs, :only => [:index]
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen resources :formality_levels
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen end
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen resources :files, only: [:new, :create]
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen resources :repository_directories, only: [:create]
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen get ':ref/files(/*path)',
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen controller: :files,
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen action: :show,
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen as: :ref,
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen constraints: FilesRouterConstraint.new
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen get ':ref/history(/:path)',
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen controller: :history,
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen action: :show,
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen as: :history,
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen constraints: { path: /.*/ }
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen get ':ref/diff',
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen controller: :diffs,
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen action: :show,
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen as: :diffs
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen # action: entries_info
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen get ':ref/:action(/:path)',
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen controller: :files,
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen as: :ref,
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen constraints: { path: /.*/ }
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen end
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen post ':repository_id/:path',
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen controller: :files,
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen action: :update,
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen as: :repository_tree,
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen constraints: { path: /.*/ }
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen get ':repository_id(/*path)',
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen controller: :files,
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen action: :show,
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen as: :repository_tree,
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen constraints: FilesRouterConstraint.new
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen get '*path',
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen controller: :ontologies,
6c9699d37fbe4d8af3682ee7f341ede8d54faa87Timo Sirainen action: :show,
9573f4283f9118315b0865998d43223fedee0246Timo Sirainen as: :iri,
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen constraints: IRIRouterConstraint.new
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen
746d35bf3dba3ae5ddbcecb9732f60d5e9de77efTimo Sirainen root :to => 'home#index'
6c9699d37fbe4d8af3682ee7f341ede8d54faa87Timo Sirainen
6c9699d37fbe4d8af3682ee7f341ede8d54faa87Timo Sirainenend
6c9699d37fbe4d8af3682ee7f341ede8d54faa87Timo Sirainen