From ec8715efd34ed313a86e679fa3c7d15fd869265e Mon Sep 17 00:00:00 2001 From: iagirre Date: Wed, 27 Dec 2017 12:15:38 +0100 Subject: [PATCH] Budget investments cannot be edited when budget is finished. Only milestones can be managed. --- .../budget_investments/_investments.html.erb | 40 ++++++++++--------- .../admin/budget_investments/show.html.erb | 6 +-- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/app/views/admin/budget_investments/_investments.html.erb b/app/views/admin/budget_investments/_investments.html.erb index fca3560a4..7996a9a2b 100644 --- a/app/views/admin/budget_investments/_investments.html.erb +++ b/app/views/admin/budget_investments/_investments.html.erb @@ -55,25 +55,27 @@ <%= investment.valuation_finished? ? t('shared.yes'): t('shared.no') %> - <% if investment.selected? %> - <%= link_to toggle_selection_admin_budget_budget_investment_path(@budget, - investment, - filter: params[:filter], - page: params[:page]), - method: :patch, - remote: true, - class: "button small expanded" do %> - <%= t("admin.budget_investments.index.selected") %> - <% end %> - <% elsif investment.feasible? && investment.valuation_finished? %> - <%= link_to toggle_selection_admin_budget_budget_investment_path(@budget, - investment, - filter: params[:filter], - page: params[:page]), - method: :patch, - remote: true, - class: "button small hollow expanded" do %> - <%= t("admin.budget_investments.index.select") %> + <% unless investment.budget.finished? %> + <% if investment.selected? %> + <%= link_to toggle_selection_admin_budget_budget_investment_path(@budget, + investment, + filter: params[:filter], + page: params[:page]), + method: :patch, + remote: true, + class: "button small expanded" do %> + <%= t("admin.budget_investments.index.selected") %> + <% end %> + <% elsif investment.feasible? && investment.valuation_finished? %> + <%= link_to toggle_selection_admin_budget_budget_investment_path(@budget, + investment, + filter: params[:filter], + page: params[:page]), + method: :patch, + remote: true, + class: "button small hollow expanded" do %> + <%= t("admin.budget_investments.index.select") %> + <% end %> <% end %> <% end %> diff --git a/app/views/admin/budget_investments/show.html.erb b/app/views/admin/budget_investments/show.html.erb index 8fd285c2e..7cf7765f7 100644 --- a/app/views/admin/budget_investments/show.html.erb +++ b/app/views/admin/budget_investments/show.html.erb @@ -6,7 +6,7 @@ <%= link_to t("admin.budget_investments.show.edit"), edit_admin_budget_budget_investment_path(@budget, @investment, - Budget::Investment.filter_params(params)) %> + Budget::Investment.filter_params(params)) unless @budget.finished? %>
@@ -34,7 +34,7 @@

<%= link_to t("admin.budget_investments.show.edit_classification"), edit_admin_budget_budget_investment_path(@budget, @investment, - {anchor: 'classification'}.merge(Budget::Investment.filter_params(params))) %> + {anchor: 'classification'}.merge(Budget::Investment.filter_params(params))) unless @budget.finished? %>


@@ -44,7 +44,7 @@ <%= render 'valuation/budget_investments/written_by_valuators' %>

- <%= link_to t("admin.budget_investments.show.edit_dossier"), edit_valuation_budget_budget_investment_path(@budget, @investment) %> + <%= link_to t("admin.budget_investments.show.edit_dossier"), edit_valuation_budget_budget_investment_path(@budget, @investment) unless @budget.finished? %>