Hide select text if budget finished

This commit is contained in:
decabeza
2019-05-17 12:00:22 +02:00
parent bec550e843
commit 035b11c460
2 changed files with 41 additions and 14 deletions

View File

@@ -47,7 +47,7 @@
id: "budget_investment_visible_to_valuators" %>
<% end %>
</td>
<td class="small text-center">
<td id="selection" class="small text-center">
<% if investment.selected? %>
<%= link_to_unless investment.budget.finished?,
t("admin.budget_investments.index.selected"),
@@ -63,8 +63,8 @@
remote: true,
class: "button small expanded" %>
<% elsif investment.feasible? && investment.valuation_finished? %>
<%= link_to_unless investment.budget.finished?,
t("admin.budget_investments.index.select"),
<% unless investment.budget.finished? %>
<%= link_to t("admin.budget_investments.index.select"),
toggle_selection_admin_budget_budget_investment_path(@budget,
investment,
filter: params[:filter],
@@ -77,6 +77,7 @@
remote: true,
class: "button small hollow expanded" %>
<% end %>
<% end %>
</td>
<% if params[:filter] == "selected" %>
<td class="small text-center">

View File

@@ -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)