diff --git a/config/routes.rb b/config/routes.rb index 6359ad589..bdf6af8a6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -46,4 +46,35 @@ Rails.application.routes.draw do # Static pages resources :pages, path: "/", only: [:show] + + resolve "Budget::Investment" do |investment, options| + [investment.budget, :investment, options.merge(id: investment)] + end + + resolve("Topic") { |topic, options| [topic.community, topic, options] } + + resolve "Legislation::Proposal" do |proposal, options| + [proposal.process, :proposal, options.merge(id: proposal)] + end + + resolve "Vote" do |vote, options| + [*resource_hierarchy_for(vote.votable), vote, options] + end + + resolve "Legislation::Question" do |question, options| + [question.process, :question, options.merge(id: question)] + end + + resolve "Legislation::Annotation" do |annotation, options| + [annotation.draft_version.process, :draft_version, :annotation, + options.merge(draft_version_id: annotation.draft_version, id: annotation)] + end + + resolve "Poll::Question" do |question, options| + [:question, options.merge(id: question)] + end + + resolve "SDG::LocalTarget" do |target, options| + [:local_target, options.merge(id: target)] + end end diff --git a/config/routes/budget.rb b/config/routes/budget.rb index f6054d95f..5dd733e83 100644 --- a/config/routes/budget.rb +++ b/config/routes/budget.rb @@ -19,7 +19,3 @@ resources :budgets, only: [:show, :index] do resource :stats, only: :show, controller: "budgets/stats" resource :executions, only: :show, controller: "budgets/executions" end - -resolve "Budget::Investment" do |investment, options| - [investment.budget, :investment, options.merge(id: investment)] -end diff --git a/config/routes/community.rb b/config/routes/community.rb index ca41ee2d1..9e010ffb7 100644 --- a/config/routes/community.rb +++ b/config/routes/community.rb @@ -1,5 +1,3 @@ resources :communities, only: [:show] do resources :topics end - -resolve("Topic") { |topic, options| [topic.community, topic, options] } diff --git a/config/routes/legislation.rb b/config/routes/legislation.rb index ae37f818b..37323a4f1 100644 --- a/config/routes/legislation.rb +++ b/config/routes/legislation.rb @@ -39,20 +39,3 @@ namespace :legislation do end end end - -resolve "Legislation::Proposal" do |proposal, options| - [proposal.process, :proposal, options.merge(id: proposal)] -end - -resolve "Vote" do |vote, options| - [*resource_hierarchy_for(vote.votable), vote, options] -end - -resolve "Legislation::Question" do |question, options| - [question.process, :question, options.merge(id: question)] -end - -resolve "Legislation::Annotation" do |annotation, options| - [annotation.draft_version.process, :draft_version, :annotation, - options.merge(draft_version_id: annotation.draft_version, id: annotation)] -end diff --git a/config/routes/poll.rb b/config/routes/poll.rb index f5be6b301..754c7c4d2 100644 --- a/config/routes/poll.rb +++ b/config/routes/poll.rb @@ -8,7 +8,3 @@ resources :polls, only: [:show, :index] do resources :answers, controller: "polls/answers", only: [:create, :destroy], shallow: false end end - -resolve "Poll::Question" do |question, options| - [:question, options.merge(id: question)] -end diff --git a/config/routes/sdg_management.rb b/config/routes/sdg_management.rb index d048bc2d1..fa496a63e 100644 --- a/config/routes/sdg_management.rb +++ b/config/routes/sdg_management.rb @@ -24,7 +24,3 @@ namespace :sdg_management do get "#{type}/:id/edit", to: "relations#edit", as: "edit_#{type.singularize}" end end - -resolve "SDG::LocalTarget" do |target, options| - [:local_target, options.merge(id: target)] -end