Budget investments cannot be edited when budget is finished. Only milestones can be managed.

This commit is contained in:
iagirre
2017-12-27 12:15:38 +01:00
parent 910323eb73
commit ec8715efd3
2 changed files with 24 additions and 22 deletions

View File

@@ -55,25 +55,27 @@
<%= investment.valuation_finished? ? t('shared.yes'): t('shared.no') %>
</td>
<td class="small">
<% 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 %>
</td>

View File

@@ -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? %>
<hr>
@@ -34,7 +34,7 @@
<p>
<%= 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? %>
</p>
<hr>
@@ -44,7 +44,7 @@
<%= render 'valuation/budget_investments/written_by_valuators' %>
<p>
<%= 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? %>
</p>
<hr>