Changes routes to use budgets resource instead of namespace

This commit is contained in:
kikito
2016-12-06 18:01:37 +01:00
parent 5538c70931
commit 8ef479bf31
5 changed files with 11 additions and 6 deletions

View File

@@ -7,7 +7,7 @@ module BudgetHelper
def namespaced_budget_investment_path(investment, options={}) def namespaced_budget_investment_path(investment, options={})
case namespace case namespace
when "management::budgets" when "management::budgets"
management_budgets_investment_path(investment, options) management_budget_investment_path(investment, options)
else else
budget_investment_path(investment, options.merge(budget_id: investment.budget_id)) budget_investment_path(investment, options.merge(budget_id: investment.budget_id))
end end

View File

@@ -1,6 +1,6 @@
<main> <main>
<span class="not-print"> <span class="not-print">
<%= render 'admin/shared/budget_investment_search', url: management_budgets_investments_path %> <%= render 'admin/shared/budget_investment_search', url: management_budget_investments_path %>
</span> </span>
<div class="wrap row"> <div class="wrap row">

View File

@@ -7,7 +7,7 @@
<div class="small-12 medium-9 column end"> <div class="small-12 medium-9 column end">
<h1 class=""><%= t("management.budget_investments.create") %></h1> <h1 class=""><%= t("management.budget_investments.create") %></h1>
<%= form_for(@investment, url: management_budgets_investments_path, method: :post) do |f| %> <%= form_for(@investment, url: management_budget_investments_path(@budget), method: :post) do |f| %>
<%= render 'shared/errors', resource: @investment %> <%= render 'shared/errors', resource: @investment %>
<div class="row"> <div class="row">

View File

@@ -3,7 +3,7 @@
<div id="budget-investments" class="budget-investments-list small-12 column"> <div id="budget-investments" class="budget-investments-list small-12 column">
<div class="not-print"> <div class="not-print">
<%= form_tag print_management_budgets_investments_path, method: :get, enforce_utf8: false do %> <%= form_tag print_management_budget_investments_path, method: :get, enforce_utf8: false do %>
<div class="small-12 medium-4 column float-left"> <div class="small-12 medium-4 column float-left">
<%= select_tag :geozone, <%= select_tag :geozone,
options_for_select(geozone_select_options.unshift([t("geozones.none"), "all"]), params[:geozone]), options_for_select(geozone_select_options.unshift([t("geozones.none"), "all"]), params[:geozone]),

View File

@@ -286,8 +286,13 @@ Rails.application.routes.draw do
get :print, on: :collection get :print, on: :collection
end end
namespace :budgets do resources :budgets, only: :index do
resources :investments, only: [:index, :new, :create, :show] do collection do
get :create_investments
get :support_investments
get :print_investments
end
resources :investments, only: [:index, :new, :create, :show], controller: 'budgets/investments' do
post :vote, on: :member post :vote, on: :member
get :print, on: :collection get :print, on: :collection
end end