lib/curation_concerns/rails/routes.rb in curation_concerns-0.1.0 vs lib/curation_concerns/rails/routes.rb in curation_concerns-0.2.0
- old
+ new
@@ -1,22 +1,25 @@
module ActionDispatch::Routing
class Mapper
-
def curation_concerns_basic_routes
resources :downloads, only: :show
+ # Batch edit routes
+ get 'upload_sets/:id/edit' => 'upload_sets#edit', as: :edit_upload_set
+ post 'upload_sets/:id' => 'upload_sets#update', as: :upload_set_file_sets
+
namespace :curation_concerns, path: :concern do
- CurationConcerns.configuration.registered_curation_concern_types.map(&:tableize).each do |curation_concern_name|
+ CurationConcerns.config.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 :generic_files, only: [:new, :create], path: 'container/:parent_id/generic_files'
- resources :generic_files, only: [:show, :edit, :update, :destroy] do
+ resources :file_sets, only: [:new, :create], path: 'container/:parent_id/file_sets'
+ resources :file_sets, only: [:show, :edit, :update, :destroy] do
member do
get :versions
put :rollback
end
end
@@ -39,11 +42,11 @@
put :remove_member
end
end
end
- # kmr added :show to make tests pass
+ # kmr added :show to make tests pass
def curation_concerns_embargo_management
resources :embargoes, only: [:index, :edit, :destroy] do
collection do
patch :update
end
@@ -54,23 +57,24 @@
end
end
end
private
- # Namespaces routes appropriately
- # @example route_namespaced_target("curation_concerns/generic_work") is equivalent to
- # namespace "curation_concerns" do
- # resources "generic_work", except: [:index]
- # end
- 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)
+
+ # Namespaces routes appropriately
+ # @example route_namespaced_target("curation_concerns/generic_work") is equivalent to
+ # namespace "curation_concerns" do
+ # resources "generic_work", except: [:index]
+ # end
+ 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
- else
- resources target, opts
end
- end
end
end