class ActionDispatch::Routing::Mapper

Public Instance Methods

worthwhile_collections() click to toggle source

Used in conjunction with Hydra::Collections::Engine routes. Adds routes for doing paginated searches within a collection's contents @example in routes.rb:

mount Hydra::Collections::Engine => '/'
worthwhile_collections
# File lib/worthwhile/rails/routes.rb, line 33
def worthwhile_collections
  resources :collections, only: :show do
    member do
      get 'page/:page', action: :index
      get 'facet/:id', action: :facet, as: :dashboard_facet
    end
    collection do
      put '', action: :update
      put :remove_member
    end
  end
end
worthwhile_curation_concerns() click to toggle source
# File lib/worthwhile/rails/routes.rb, line 4
def worthwhile_curation_concerns
  resources :downloads, only: :show
  namespace :curation_concern, path: :concern do
    Worthwhile.configuration.registered_curation_concern_types.map(&:tableize).each do |curation_concern_name|
      namespaced_resources curation_concern_name, except: [:index]
    end
    resources :permissions, only: [] do
      member do
        get :confirm
        post :copy
      end
    end
    resources :linked_resources, only: [:new, :create], path: 'container/:parent_id/linked_resources'
    resources :linked_resources, only: [:show, :edit, :update, :destroy]
    resources :generic_files, only: [:new, :create], path: 'container/:parent_id/generic_files'
    resources :generic_files, only: [:show, :edit, :update, :destroy] do
      member do
        get :versions
        put :rollback
      end
    end
  end
end
worthwhile_embargo_management() click to toggle source
# File lib/worthwhile/rails/routes.rb, line 46
def worthwhile_embargo_management
  resources :embargoes, only: [:index, :edit, :destroy] do
    collection do
      patch :update
    end
  end
  resources :leases, only: [:index, :edit, :destroy] do
    collection do
      patch :update
    end
  end
end

Private Instance Methods

namespaced_resources(target, opts={}) click to toggle source

Namespaces routes appropriately @example route_namespaced_target(“worthwhile/generic_work”) is equivalent to

namespace "worthwhile" do
  resources "generic_work", except: [:index]
end
# File lib/worthwhile/rails/routes.rb, line 65
def namespaced_resources(target, opts={})
  if target.include?("/")
    the_namespace = target[0..target.index("/")-1]
    new_target = target[target.index("/")+1..-1]
    namespace the_namespace do
      namespaced_resources(new_target, opts)
    end
  else
    resources target, opts
  end
end