routes.rb revision 4949048bda09e116ee3627383e831455954cbe41
1245N/Arequire 'sidekiq/web' if defined? Sidekiq
2362N/Arequire Rails.root.join('lib', 'router_constraints.rb')
1245N/A
1245N/ASpecroutes.define(Ontohub::Application.routes) do
1245N/A
1245N/A resources :filetypes, only: :create
2362N/A
1245N/A # IRI Routing #
2362N/A ###############
1245N/A # as per Loc/Id definition
1245N/A
1245N/A # Special (/ref-based) Loc/Id routes
1245N/A specified_get '/ref/:reference/:repository_id/*locid' => 'ontologies#show',
1245N/A as: :ontology_iri_versioned,
1245N/A constraints: [
1245N/A RefLocIdRouterConstraint.new(Ontology, ontology: :id),
1245N/A MIMERouterConstraint.new('text/plain', 'text/html')
1245N/A ]
1245N/A
1245N/A # MMT-Support
2362N/A specified_get '/ref/mmt/:repository_id/*path' => 'ontologies#show',
2362N/A as: :ontology_iri_mmt,
2362N/A constraints: [
1245N/A MMTRouterConstraint.new(Ontology, ontology: :id),
1245N/A MIMERouterConstraint.new('text/plain', 'text/html')
1245N/A ]
1245N/A
1245N/A specified_get '/ref/mmt/:repository_id/*path' => 'mappings#show',
1245N/A as: :ontology_iri_mmt,
1245N/A constraints: [
1245N/A MMTRouterConstraint.new(Mapping, ontology: :ontology_id, element: :id),
1245N/A MIMERouterConstraint.new('text/plain', 'text/html')
1245N/A ]
1245N/A
1245N/A specified_get '/ref/mmt/:repository_id/*path' => 'symbols#index',
1245N/A as: :ontology_iri_mmt,
1245N/A constraints: [
1245N/A MMTRouterConstraint.new(OntologyMember::Symbol, ontology: :ontology_id),
1245N/A MIMERouterConstraint.new('text/plain', 'text/html')
1245N/A ]
1245N/A
1245N/A specified_get '/ref/mmt/:repository_id/*path' => 'sentences#index',
1245N/A as: :ontology_iri_mmt,
1245N/A constraints: [
1245N/A MMTRouterConstraint.new(Sentence, ontology: :ontology_id),
1245N/A MIMERouterConstraint.new('text/plain', 'text/html')
1245N/A ]
1245N/A
1245N/A # Subsites for ontologies
1245N/A ontology_subsites = %i(
1245N/A mappings symbols children
1245N/A sentences theorems comments
1245N/A metadata ontology_versions graphs
1245N/A projects categories tasks license_models formality_levels
1245N/A )
1245N/A
1245N/A ontology_subsites.each do |category|
1245N/A specified_get "/:repository_id/*locid///#{category}" => "#{category}#index",
1245N/A as: :"ontology_iri_#{category}",
1245N/A constraints: [
1245N/A LocIdRouterConstraint.new(Ontology, ontology: :ontology_id),
1245N/A ]
1245N/A end
1245N/A
1245N/A # Loc/Id-Show(-equivalent) routes
1245N/A ######
1245N/A specified_get '/:repository_id/*locid' => 'ontologies#show',
1245N/A as: :ontology_iri,
1245N/A constraints: [
1245N/A LocIdRouterConstraint.new(Ontology, ontology: :id),
1245N/A MIMERouterConstraint.new('text/plain', 'text/html'),
1245N/A ]
1245N/A
1245N/A specified_get '/:repository_id/*locid' => 'mappings#show',
1245N/A as: :mapping_iri,
1245N/A constraints: [
1245N/A LocIdRouterConstraint.new(Mapping, ontology: :ontology_id, element: :id),
1245N/A MIMERouterConstraint.new('text/plain', 'text/html'),
1245N/A ]
1245N/A
1245N/A specified_get '/:repository_id/*locid' => 'symbols#index',
1245N/A as: :symbol_iri,
1245N/A constraints: [
1245N/A LocIdRouterConstraint.new(OntologyMember::Symbol, ontology: :ontology_id),
1245N/A MIMERouterConstraint.new('text/html'),
1245N/A ]
1245N/A
1245N/A specified_get '/:repository_id/*locid' => 'sentences#index',
1245N/A as: :ontology_iri,
1245N/A constraints: [
1245N/A LocIdRouterConstraint.new(Sentence, ontology: :ontology_id),
1245N/A MIMERouterConstraint.new('text/plain', 'text/html'),
1245N/A ]
1245N/A
1245N/A #
1245N/A ###############
1245N/A
1245N/A resources :ontology_types, only: :show
1245N/A get '/after_signup', to: 'home#show' , as: 'after_sign_up'
1245N/A
1245N/A devise_for :users, controllers: {
1245N/A confirmations: 'users/confirmations',
1245N/A registrations: 'users/registrations'
1245N/A }
1245N/A resources :users, only: :show
1245N/A resources :keys, except: [:show, :edit, :update]
1245N/A
1245N/A resources :logics, only: [:index, :show] do
1245N/A resources :supports, :only => [:create, :update, :destroy, :index]
1245N/A resources :graphs, :only => [:index]
1245N/A end
1245N/A
1245N/A resources :languages do
1245N/A resources :supports, :only => [:create, :update, :destroy, :index]
1245N/A end
1245N/A
1245N/A resources :language_mappings
1245N/A resources :logic_mappings
1245N/A
1245N/A resources :mappings, only: :index
1245N/A
1245N/A resources :categories, :only => [:index, :show]
1245N/A resources :projects
1245N/A resources :tasks
1245N/A resources :license_models
1245N/A resources :formality_levels
1245N/A
1245N/A
1245N/A resources :language_adjoints
1245N/A resources :logic_adjoints
1245N/A
1245N/A resources :serializations
1245N/A
1245N/A namespace :admin do
1245N/A resources :teams, :only => :index
1245N/A resources :users
1245N/A resources :jobs, :only => :index
1245N/A resources :status, only: :index
1245N/A end
1245N/A
1245N/A authenticate :user, lambda { |u| u.admin? } do
1245N/A mount Sidekiq::Web => 'admin/sidekiq'
1245N/A end
1245N/A
1245N/A namespace :api, defaults: { format: 'json' } do
1245N/A namespace :v1 do
1245N/A resources :categories, only: [:index]
1245N/A resources :repositories, only: [:index, :update]
1245N/A resources :ontologies, only: [:index, :update]
1245N/A end
1245N/A end
1245N/A
1245N/A resources :ontologies, only: [:index] do
1245N/A collection do
1245N/A get 'search' => 'ontology_search#search'
1245N/A end
1245N/A end
1245N/A
1245N/A resources :mappings do
1245N/A get 'update_version', :on => :member
1245N/A end
1245N/A
1245N/A resources :teams do
1245N/A resources :permissions, :only => [:index], :controller => 'teams/permissions'
1245N/A resources :team_users, :only => [:index, :create, :update, :destroy], :path => 'users'
1245N/A end
1245N/A
1245N/A get 'autocomplete' => 'autocomplete#index'
1245N/A get 'symbols_search' => 'symbols_search#index'
1245N/A
1245N/A resources :repositories do
1245N/A resources :s_s_h_access, :only => :index, path: 'ssh_access'
1245N/A resources :permissions, :only => [:index, :create, :update, :destroy]
1245N/A resources :url_maps, except: :show
1245N/A resources :errors, :only => :index
1245N/A resources :repository_settings, :only => :index
1245N/A
1245N/A resources :ontologies, only: [:index, :show, :edit, :update, :destroy] do
1245N/A collection do
1245N/A post 'retry_failed' => 'ontologies#retry_failed'
1245N/A get 'search' => 'ontology_search#search'
1245N/A end
1245N/A member do
1245N/A post 'retry_failed' => 'ontologies#retry_failed'
1245N/A end
1245N/A resources :children, :only => :index
1245N/A resources :symbols, only: :index
1245N/A resources :sentences, :only => :index
1245N/A resources :theorems, only: :index
1245N/A resources :mappings do
1245N/A get 'update_version', :on => :member
1245N/A end
1245N/A resources :ontology_versions, :only => [:index, :show, :new, :create], :path => 'versions' do
1245N/A resource :oops_request, :only => [:show, :create]
1245N/A end
1245N/A resources :categories
1245N/A resources :tasks
1245N/A resources :license_models
1245N/A resources :tools
1245N/A resources :projects
1245N/A
1245N/A resources :metadata, :only => [:index, :create, :destroy]
1245N/A resources :comments, :only => [:index, :create, :destroy]
1245N/A resources :graphs, :only => [:index]
1245N/A resources :formality_levels
1245N/A
1245N/A end
1245N/A
1245N/A resources :files, only: [:new, :create]
1245N/A resources :repository_directories, only: [:create]
1245N/A
1245N/A get ':ref/files(/*path)',
1245N/A controller: :files,
1245N/A action: :show,
1245N/A as: :ref,
1245N/A constraints: FilesRouterConstraint.new
1245N/A
1245N/A get ':ref/history(/:path)',
1245N/A controller: :history,
1245N/A action: :show,
1245N/A as: :history,
1245N/A constraints: { path: /.*/ }
1245N/A
1245N/A get ':ref/diff',
1245N/A controller: :diffs,
1245N/A action: :show,
1245N/A as: :diffs
1245N/A
1245N/A # action: entries_info
1245N/A get ':ref/:action(/:path)',
1245N/A controller: :files,
1245N/A as: :ref,
1245N/A constraints: { path: /.*/ }
1245N/A end
1245N/A
1245N/A post ':repository_id/:path',
1245N/A controller: :files,
1245N/A action: :update,
1245N/A as: :repository_tree,
1245N/A constraints: { path: /.*/ }
1245N/A
1245N/A get ':repository_id(/*path)',
1245N/A controller: :files,
1245N/A action: :show,
1245N/A as: :repository_tree,
1245N/A constraints: FilesRouterConstraint.new
1245N/A
1245N/A get '*path',
1245N/A controller: :ontologies,
1245N/A action: :show,
1245N/A as: :iri,
1245N/A constraints: IRIRouterConstraint.new
1245N/A
1245N/A root :to => 'home#index'
1245N/A
1245N/Aend
1245N/A