Edit Budget Investment only in accepting phase (#3716)

This way users who made a typo can fix it before the investment is reviewed.
This commit is contained in:
denialtorres
2019-10-18 06:59:14 -05:00
committed by Javier Martín
parent 970c3238fb
commit bb627a7117
13 changed files with 82 additions and 5 deletions

View File

@@ -20,7 +20,7 @@ module Budgets
before_action :load_ballot, only: [:index, :show]
before_action :load_heading, only: [:index, :show]
before_action :set_random_seed, only: :index
before_action :load_categories, only: [:index, :new, :create]
before_action :load_categories, only: [:index, :new, :create, :edit, :update]
before_action :set_default_budget_filter, only: :index
before_action :set_view, only: :index
before_action :load_content_blocks, only: :index
@@ -76,6 +76,15 @@ module Budgets
end
end
def update
if @investment.update(investment_params)
redirect_to budget_investment_path(@budget, @investment),
notice: t("flash.actions.update.budget_investment")
else
render "edit"
end
end
def destroy
@investment.destroy
redirect_to user_path(current_user, filter: "budget_investments"), notice: t("flash.actions.destroy.budget_investment")