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') %> <%= investment.valuation_finished? ? t('shared.yes'): t('shared.no') %>
</td> </td>
<td class="small"> <td class="small">
<% if investment.selected? %> <% unless investment.budget.finished? %>
<%= link_to toggle_selection_admin_budget_budget_investment_path(@budget, <% if investment.selected? %>
investment, <%= link_to toggle_selection_admin_budget_budget_investment_path(@budget,
filter: params[:filter], investment,
page: params[:page]), filter: params[:filter],
method: :patch, page: params[:page]),
remote: true, method: :patch,
class: "button small expanded" do %> remote: true,
<%= t("admin.budget_investments.index.selected") %> class: "button small expanded" do %>
<% end %> <%= t("admin.budget_investments.index.selected") %>
<% elsif investment.feasible? && investment.valuation_finished? %> <% end %>
<%= link_to toggle_selection_admin_budget_budget_investment_path(@budget, <% elsif investment.feasible? && investment.valuation_finished? %>
investment, <%= link_to toggle_selection_admin_budget_budget_investment_path(@budget,
filter: params[:filter], investment,
page: params[:page]), filter: params[:filter],
method: :patch, page: params[:page]),
remote: true, method: :patch,
class: "button small hollow expanded" do %> remote: true,
<%= t("admin.budget_investments.index.select") %> class: "button small hollow expanded" do %>
<%= t("admin.budget_investments.index.select") %>
<% end %>
<% end %> <% end %>
<% end %> <% end %>
</td> </td>

View File

@@ -6,7 +6,7 @@
<%= link_to t("admin.budget_investments.show.edit"), <%= link_to t("admin.budget_investments.show.edit"),
edit_admin_budget_budget_investment_path(@budget, @investment, edit_admin_budget_budget_investment_path(@budget, @investment,
Budget::Investment.filter_params(params)) %> Budget::Investment.filter_params(params)) unless @budget.finished? %>
<hr> <hr>
@@ -34,7 +34,7 @@
<p> <p>
<%= link_to t("admin.budget_investments.show.edit_classification"), <%= link_to t("admin.budget_investments.show.edit_classification"),
edit_admin_budget_budget_investment_path(@budget, @investment, 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> </p>
<hr> <hr>
@@ -44,7 +44,7 @@
<%= render 'valuation/budget_investments/written_by_valuators' %> <%= render 'valuation/budget_investments/written_by_valuators' %>
<p> <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> </p>
<hr> <hr>