Fix investments link in single heading budgets
The link to "See all investments" didn't have the `heading_id` parameter, which resulted in the ballot information not being displayed when in the voting phase. We could modify the link to include the `heading_id` parameter, but IMHO it's more robust to select the heading automatically when there's only one heading. That way manually accessing the page without a `heading_id` parameter will still work as if the heading had been selected.
This commit is contained in:
@@ -135,6 +135,9 @@ module Budgets
|
|||||||
@heading = @budget.headings.find_by_slug_or_id! params[:heading_id]
|
@heading = @budget.headings.find_by_slug_or_id! params[:heading_id]
|
||||||
@assigned_heading = @ballot&.heading_for_group(@heading.group)
|
@assigned_heading = @ballot&.heading_for_group(@heading.group)
|
||||||
load_map
|
load_map
|
||||||
|
elsif @budget.single_heading?
|
||||||
|
@heading = @budget.headings.first
|
||||||
|
load_map
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1356,6 +1356,9 @@ describe "Budget Investments" do
|
|||||||
expect(page).to have_content investment2.title
|
expect(page).to have_content investment2.title
|
||||||
expect(page).to have_content "€20,000"
|
expect(page).to have_content "€20,000"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
expect(page).to have_link "Submit my ballot"
|
||||||
|
expect(page).to have_content "STILL AVAILABLE TO YOU €666,666"
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Order by cost (only when balloting)" do
|
scenario "Order by cost (only when balloting)" do
|
||||||
|
|||||||
Reference in New Issue
Block a user