diff --git a/app/views/admin/budget_investments/_select_investment.html.erb b/app/views/admin/budget_investments/_select_investment.html.erb
index 040d128e1..788d9824b 100644
--- a/app/views/admin/budget_investments/_select_investment.html.erb
+++ b/app/views/admin/budget_investments/_select_investment.html.erb
@@ -47,7 +47,7 @@
id: "budget_investment_visible_to_valuators" %>
<% end %>
-
+ |
<% if investment.selected? %>
<%= link_to_unless investment.budget.finished?,
t("admin.budget_investments.index.selected"),
@@ -63,19 +63,20 @@
remote: true,
class: "button small expanded" %>
<% elsif investment.feasible? && investment.valuation_finished? %>
- <%= link_to_unless investment.budget.finished?,
- t("admin.budget_investments.index.select"),
- toggle_selection_admin_budget_budget_investment_path(@budget,
- investment,
- filter: params[:filter],
- sort_by: params[:sort_by],
- min_total_supports: params[:min_total_supports],
- max_total_supports: params[:max_total_supports],
- advanced_filters: params[:advanced_filters],
- page: params[:page]),
- method: :patch,
- remote: true,
- class: "button small hollow expanded" %>
+ <% unless investment.budget.finished? %>
+ <%= link_to t("admin.budget_investments.index.select"),
+ toggle_selection_admin_budget_budget_investment_path(@budget,
+ investment,
+ filter: params[:filter],
+ sort_by: params[:sort_by],
+ min_total_supports: params[:min_total_supports],
+ max_total_supports: params[:max_total_supports],
+ advanced_filters: params[:advanced_filters],
+ page: params[:page]),
+ method: :patch,
+ remote: true,
+ class: "button small hollow expanded" %>
+ <% end %>
<% end %>
|
<% if params[:filter] == "selected" %>
diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb
index bfc8e7881..79bdd3483 100644
--- a/spec/features/admin/budget_investments_spec.rb
+++ b/spec/features/admin/budget_investments_spec.rb
@@ -1407,6 +1407,32 @@ feature "Admin budget investments" do
end
end
+ scenario "Show only selected text when budget is finished" do
+ budget.update(phase: "finished")
+
+ visit admin_budget_budget_investments_path(budget)
+
+ within("#budget_investment_#{unfeasible_bi.id} #selection") do
+ expect(page).not_to have_content("Select")
+ expect(page).not_to have_content("Selected")
+ end
+
+ within("#budget_investment_#{feasible_bi.id} #selection") do
+ expect(page).not_to have_content("Select")
+ expect(page).not_to have_content("Selected")
+ end
+
+ within("#budget_investment_#{feasible_vf_bi.id} #selection") do
+ expect(page).not_to have_content("Select")
+ expect(page).not_to have_content("Selected")
+ end
+
+ within("#budget_investment_#{selected_bi.id} #selection") do
+ expect(page).not_to contain_exactly("Select")
+ expect(page).to have_content("Selected")
+ end
+ end
+
scenario "Selecting an investment", :js do
visit admin_budget_budget_investments_path(budget)